bit-band test

Dependencies:   mbed

Fork of bit-band by vics66@...

Files at this revision

API Documentation at this revision

Comitter:
moo
Date:
Mon Jun 02 02:28:30 2014 +0000
Child:
1:95cec43280f9
Commit message:
bit-band test;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 02 02:28:30 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file