When programming ARM-based microcontrollers, I'm used to see a MEMORY{..}
segment in the linkerscript like this:
MEMORY
{
FLASH (rx): ORIGIN = 0x08000000, LENGTH = 128K
RAM (xrw): ORIGIN = 0x20000000, LENGTH = 32K
}
The access rights are easy to understand:
r
: readw
: writex
: execute
I'm making my first steps in the world of RISC-V based microcontrollers. The GD32VF103CBT6
microcontroller from GigaDevice has the following MEMORY{..}
segment in its linkerscript:
MEMORY
{
/* Run in FLASH */
flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 64k
ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 20k
/* Run in RAM */
/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 15k */
/* ram (wxa!ri) : ORIGIN = 0x20003C00, LENGTH = 5K */
}
How should I interpret these access rights?
They're not really "access rights", but rather "what kind of sections may be placed here".
From the GNU LD documentation (with some formatting mangled in the process of quotint :
With that background, I would interpret your config as follows:
...means that the "flash" region may contain anything except writeable sections, and
...means that the "ram" region may contain anything except read-only and initialized sections.