2020-07-14 10:31 PM
Hello everybody
Controller: STM32H743ZI
I have a const uint8_t array which I want to place in the flash at a specific location. The location is Address: 0x08180000. For that reason I created a *.sct file. The used tag is "MXG5XX".
LOAD_FLASH_BANK 0x08000000 0x00200000
{
EXEC_FLASH_BANK_1 0x08000000 0x00100000
{
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
EXEC_FLASH_BANK_2 0x08180000 0x00080000
{
*(.MXG5XX)
}
EXEC_DTCM 0x20000000 0x00020000
{
.ANY (+RW)
.ANY (+ZI)
}
EXEC_AXI 0x24010000 0x00070000
{
.ANY (+RW)
.ANY (+ZI)
}
EXEC_ITCM 0x00000000 0x10000
{
.ANY (itcm)
}
}
The const array is called mxg5xx_firmware_binary and is defined as follows:
__attribute__((section (".MXG5XX")))
const uint8_t mxg5xx_firmware_binary [] = {
0xB0, 0x14, 0x00, 0x20, 0xDD, 0x11, 0x00, 0x00, 0xE5, 0x11, 0x00, 0x00, 0xE7, 0x11, 0x00, 0x00
};
After the build process the *.map shows the following for the array:
Image Symbol Table
...
mxg5xx_firmware_binary 0x08180000 Data 16 main.o(.MXG5XX)
...
So far everything seems to be correct.
If I start debugging now the address for the const array is correct (0x08180000) but the memory at this address shows only 0xFF and not the values defined for the array.
I have a minimum project for NUCLEO-H743ZI.
Any Idea? Thank you.
Regards
Jakob
Solved! Go to Solution.
2020-07-15 04:43 AM
The base addresses need to be consistent, you can't have the data floating in the middle of the load region, the scatter loader wants to unpack it.
2020-07-14 11:29 PM
Split into two load regions, with the second describing the last 512KB, and put the second execution region inside that.
2020-07-14 11:37 PM
Hi Clive
Thank you for your response.
Do you mean like this:
LOAD_FLASH_BANK_1 0x08000000 0x00100000
{
EXEC_FLASH_BANK 0x08000000 0x00100000
{
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
EXEC_DTCM 0x20000000 0x00020000
{
.ANY (+RW)
.ANY (+ZI)
}
EXEC_AXI 0x24010000 0x00070000
{
.ANY (+RW)
.ANY (+ZI)
}
EXEC_ITCM 0x00000000 0x10000
{
.ANY (itcm)
}
}
LOAD_FLASH_BANK_2 0x08100000 0x00100000
{
;EXEC_FLASH_BANK_2_1 0x08100000 0x00080000
;{
;}
EXEC_FLASH_BANK_2_2 0x08180000 0x00080000
{
*(.MXG5XX)
}
}
It behaves the same.
Regards
Jakob
2020-07-15 03:54 AM
Hi Clive
Please se my answer below.
Thank you.
2020-07-15 04:43 AM
The base addresses need to be consistent, you can't have the data floating in the middle of the load region, the scatter loader wants to unpack it.
2020-07-15 04:54 AM
... Thank you. This version works.
LOAD_FLASH_BANK_1 0x08000000 0x00100000
{
EXEC_FLASH_BANK_1 0x08000000 0x00100000
{
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
EXEC_DTCM 0x20000000 0x00020000
{
.ANY (+RW)
.ANY (+ZI)
}
EXEC_AXI 0x24010000 0x00070000
{
.ANY (+RW)
.ANY (+ZI)
}
EXEC_ITCM 0x00000000 0x10000
{
.ANY (itcm)
}
}
LOAD_FLASH_BANK_2 0x08180000 0x00080000
{
EXEC_FLASH_BANK_2 0x08180000 0x00008000
{
*(.MXG5XX)
}
}
.