moo
/
bit-band
bit-band test
Fork of bit-band by
Diff: main.cpp
- Revision:
- 0:cd40794dcbe8
- Child:
- 1:95cec43280f9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jun 02 02:28:30 2014 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" + +DigitalOut led1(LED1); + +extern "C" void HardFault_Handler() {__nop();} + +int main() +{ + volatile uint8_t *a1 = (uint8_t*)(0x10000000); // SRAM先頭アドレス + *a1 = (uint8_t)0x1; // Memory windowsにて0x1になることを確認 + + volatile uint8_t *a2 = (uint8_t*)(0x22000000); // SRAM先頭アドレスをbit-bandで指定 + *a2 = (uint8_t)0x0; // Memory windowsにて0x01になることを確認出来ない + + led1 = *a1; // この行を実行するとHardFault_Handler()が実行される + while (1); +}