Map - Geek went Freak!

Map

Cortex-M: Fixed memory map

To aid portability of code between different Cortex-M micro-controller across vendors, M-profile architectures (ARMv6-M, ARMv7-M, ARMv7E-M, etc) defines standard fixed memory map.

Area Address range Notes STM32F407
Vendor specific 0xE0100000:0xFFFFFFFF
PPB 0xE0000000:0xE00FFFFF NVIC, SCS, ETM, ITM, FPB NVIC, SCS, ETM, ITM, FPB
External device 0xA0000000:0xDFFFFFFF SD card, etc FSMC
External RAM 0x60000000:0x9FFFFFFF DDR, LCD, etc DDR
Peripheral 0x40000000:0x5FFFFFFF AHB, APB peripherals UART, Timers, ADC, etc
SRAM 0x20000000:0x3FFFFFFF SRAM/SDRAM/Data Data memory
Code 0x00000000:0x1FFFFFFF ROM/Flash/Code Code ROM memory

Maximum Flash and RAM size

Because of fixed memory map, both RAM and Flash areas in the memory map are 0x1FFFFFFF in length. This means maximum size of 512 MB.

GoLang: Marshall slice and map members of struct into JSON

Go has an incredibly user friendly built-in JSON encoder and decoder. One can create a struct with slice and map members and expect the encoding/json package to marshal and un-marshal it without any hassle. Here is a showcase program of how to marshal and unmarshal a struct containing slice and map members:

Output

Before marshaling:  
IntF: 5  
StringF: 55  
FloatF: 55.500000  
SliceF: [5 55 555]  
MapF: map[5:%!s(int=5) 55:%!s(int=55) 555:%!s(int=555)]  

Marshalled data: {"IntF":5,"StringF":"55","FloatF":55.5,"SliceF":["5","55","555"],"MapF":{"5":5,"55":55,"555":555}}


Unmarshaled data:
{"IntF":555,"StringF":"5","FloatF":5.555,"SliceF":["555","55","5"],"MapF":{"5.5":5.5,"55.5":55.5,"555.5":555.5}}

After unmarshaling
IntF: 555
StringF: 5
FloatF: 5.555000
SliceF: [555 55 5]
MapF: map[5.5:%!s(int=0) 55.5:%!s(int=0) 555.5:%!s(int=0)]