Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:333b2c3ec494, committed 2012-03-04
- Comitter:
- simon
- Date:
- Sun Mar 04 08:03:59 2012 +0000
- Commit message:
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 |
diff -r 000000000000 -r 333b2c3ec494 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Mar 04 08:03:59 2012 +0000
@@ -0,0 +1,30 @@
+// Example of hanging when reading a bad pointer
+
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+
+int x[10] = {0};
+
+extern "C" void HardFault_Handler() {
+ error("Hit HardFault handler!\n");
+}
+
+int main() {
+ int *ok_ptr = x;
+ int *bad_ptr = (int*)0xe600b0; // not in RAM!
+ printf("ok_ptr = 0x%08X, bad_ptr = 0x%08X\n", ok_ptr, bad_ptr);
+
+ int ok_read = ok_ptr[0];
+ printf("ok_read = %d\n", ok_read);
+
+ int bad_read = bad_ptr[0];
+ printf("bad_read = %d\n", bad_read);
+
+ while(1) {
+ myled = 1;
+ wait(0.2);
+ myled = 0;
+ wait(0.2);
+ }
+}
diff -r 000000000000 -r 333b2c3ec494 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Mar 04 08:03:59 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4c0c40fd0593