Nuvoton
/
NuMaker-mbed-noXRAM-example
NuMaker without external SRAM configuration
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 // main() runs in its own thread in the OS 00004 int main() { 00005 00006 while (true) { 00007 void *heap = new uint8_t[32]; 00008 00009 uint32_t heap_ = ((uint32_t) heap) & 0xF0000000; 00010 switch (heap_) { 00011 case 0x20000000: 00012 printf("Heap allocated at 0x%08x (IRAM)\r\n", heap); 00013 break; 00014 00015 case 0x60000000: 00016 printf("Heap allocated at 0x%08x (XRAM)\r\n", heap); 00017 break; 00018 00019 default: 00020 printf("Heap allocated at 0x%08x (ILLEGAL)\r\n", heap); 00021 } 00022 00023 delete [] heap; 00024 heap = NULL; 00025 00026 wait(2.0); 00027 } 00028 00029 return 0; 00030 }
Generated on Tue Jul 12 2022 16:57:34 by 1.7.2