# Migrating from ARMLINK to LD script with overlays

I have a app.sct ARMLINK script file with overlay section:

``````OVERLAY_A ImageLimit(RAM_DATA_ON) OVERLAY
{
*(.app.overlay_a)
}
``````

I'm trying to achive the same result with gcc linker script as follows:

``````OVERLAY SIZEOF(RAM_DATA_ON) :
{
OVERLAY_A
{
*(.app.overlay_a)
}
}
``````

ARMLINK automatically defines these symbols for overlay section:

Image\$\$OVERLAY_A\$\$ZI\$\$Length

Image\$\$OVERLAY_A\$\$RW\$\$Length

Image\$\$OVERLAY_A\$\$RO\$\$Length

Image\$\$OVERLAY_A\$\$RW\$\$Base

Image\$\$OVERLAY_A\$\$RO\$\$Base

which are actively used by application.

How to correctly define these in ld script file overlay? How do I get RO, RW, ZI parts from `.app.overlay_a input section?`

Parents
• Hi Alexey,

So, unlike armlink, GNU ld does not automatically create these linker-defined symbols around sections. Instead, those need to be defined specifically in the linker script by doing something like:

_my_data_start_marker_ = . ;
.data:
{
*(.data*)
}
_my_data_end_marker_ = . ;

which would give you the equivalent of:

Image\$\$something\$\$RW\$\$Base
Image\$\$something\$\$RW\$\$Limit

and then the equivalent of Image\$\$something\$\$RW\$\$Length would be `_my_data_end_marker_ - _my_data_start_marker_`

Also note that GNU uses different naming for:
RO: .text
RW: .data
ZI: .bss

As such, it looks like you'll have to break down the `*(.app.overlay_a)` into 3: one for the .text, one for .bss and one for .data and create symbols around them as `symbol = .`.

Hope this helps!

(I think these might be created as `*(.app.overlay_a.data) , *(.app.overlay_a.text) , *(.app.overlay_a.bss)` ... I don't have a linker script and build to check this at hand rn and it may depend on how you've created `.app.overlay_a`, so you might have to fiddle with that until it works)

No data
More questions in this forum

779 views
0 replies
Started
by

81 views
Latest

674 views
10 replies
Latest

196 views