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.
main.cpp
00001 // Example of hanging when reading a bad pointer 00002 00003 #include "mbed.h" 00004 00005 DigitalOut myled(LED1); 00006 00007 int x[10] = {0}; 00008 00009 extern "C" void HardFault_Handler() { 00010 error("Hit HardFault handler!\n"); 00011 } 00012 00013 int main() { 00014 int *ok_ptr = x; 00015 int *bad_ptr = (int*)0xe600b0; // not in RAM! 00016 printf("ok_ptr = 0x%08X, bad_ptr = 0x%08X\n", ok_ptr, bad_ptr); 00017 00018 int ok_read = ok_ptr[0]; 00019 printf("ok_read = %d\n", ok_read); 00020 00021 int bad_read = bad_ptr[0]; 00022 printf("bad_read = %d\n", bad_read); 00023 00024 while(1) { 00025 myled = 1; 00026 wait(0.2); 00027 myled = 0; 00028 wait(0.2); 00029 } 00030 }
Generated on Wed Jul 13 2022 17:00:23 by
