Specifying External Memories
You can place your code and data into external memories (e.g. SPI FLASH mapped to the address space) by using the Additional Memories page of VisualGDB Project Properties:
Once you specify your memories in the list, VisualGDB will create 3 files and add them to your project:
- A modified linker script in your project directory (.lds) defining the new memories
- Generated code from loading custom RAMs from your main FLASH (ExtraMemories.c)
- A header file with preprocessor macros for placing code and data into the memories
In order to place your code, initialized or uninitialized variable to the new memory, simply include the "ExtraMemories.h" file and declare your code/variable using <Memory>_TEXT, <Memory>_DATA or <Memory>_BSS macros:
The table below explains the meaning of the columns in the additional memory table:
Field | Description |
---|---|
Memory name | User-friendly memory name. Will be used to define the preprocessor macros for placing code/data into that memory. |
Address | The starting address of the memory. |
Size | Memory size in bytes. E.g. 32768, 32K or 0x8000. |
Type | Specify "RAM" to automatically load the code and initialized data from the main FLASH on startup. Specify "FLASH" to generate the <Project Name>-<Memory name>.bin files for programming with an external programmer. |
Contains code | Specifies whether VisualGDB should define the .<memory name>_text section and the <MEMORY NAME>_TEXT macro to place code into the memory |
Contains data | Specifies whether VisualGDB should define the .<memory name>_data section (initialized data) and/or .<memory name>_bss section (uninitialized data) and the corresponding preprocessor macros. |