Build fails on sdcc 4.1.0/4.2.0
Building with sdcc 4.1.0 / 4.2.0 fails due to insufficient space to allocate OSEG (overlay segment).
This is the internal RAM map from a working build (sdcc 4.0.0, Debian):
jhall@toaster:~/workspace/librem-ec/build/purism/librem_14/1.12-2-g64b01ec-dirty_2023-02-02$ cat ec.mem
Internal RAM layout:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x00:|0|0|0|0|0|0|0|0|a|a|a|a|a|a|b|b|
0x10:|b|b|b|b|b|b|b|b|b|c|d|d|e|e|e|e|
0x20:|e|e|e|e|e|e|e|f|f|f|f|f|f|f|f|f|
0x30:|f|f|f|f|f|f|f|f|f|f|f|f|f|f|f|f|
0x40:|f|f|f|f|f|f|g|g|g|g|g|g|g|g|g|g|
0x50:|g|g|g|g|g|g|g|g|g|g|g|g|g|g|g|g|
0x60:|g|g|g|h|h|h|h|h|i|j|j|j|j|j|j|j|
0x70:|j|j|j|Q|Q|Q|Q|Q|Q|Q|Q|S|S|S|S|S|
0x80:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x90:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xa0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xb0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xc0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xd0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xe0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xf0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData, S:Stack, A:Absolute
Stack starts at: 0x7b (sp set to 0x7a) with 133 bytes available.
No spare internal RAM space left.
Other memory:
Name Start End Size Max
---------------- -------- -------- -------- --------
PAGED EXT. RAM 0 256
EXTERNAL RAM 0x0001 0x052c 1324 2048
ROM/EPROM/FLASH 0x0000 0xa9d9 42524 65536
Internal RAM is full, 133 bytes allocated to stack. OSEG (Q) is 8 bytes.
Non-working build (sdcc 4.1.0, Fedora):
Internal RAM layout:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x00:|0|0|0|0|0|0|0|0|a|a|a|a|a|a|b|b|
0x10:|b|b|b|b|b|b|b|b|b|b|c|d|d|i| | |
0x20:|B|B|e|e|e|e|e|e|e|e|e|e|e|e|f|f|
0x30:|f|f|f|f|f|f|f|f|f|f|f|f|f|f|f|f|
0x40:|f|f|f|f|f|f|f|f|f|f|f|f|f|g|g|g|
0x50:|g|g|g|g|g|g|g|g|g|g|g|g|g|g|g|g|
0x60:|g|g|g|g|g|g|g|g|g|g|h|h|h|h|h|j|
0x70:|j|j|j|j|j|j|j|j|j|Q|Q|Q|Q|S|S|S|
0x80:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x90:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xa0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xb0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xc0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xd0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xe0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xf0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData, S:Stack, A:Absolute
ERROR: Couldn't get 8 bytes allocated in internal RAM for area OSEG.
Stack starts at: 0x7d (sp set to 0x7c) with 131 bytes available.
The largest spare internal RAM space starts at 0x1e with 2 bytes available.
Other memory:
Name Start End Size Max
---------------- -------- -------- -------- --------
PAGED EXT. RAM 0 256
EXTERNAL RAM 0x0001 0x052b 1323 2048
ROM/EPROM/FLASH 0x0000 0xaa02 42565 65536
-
b
is 1 byte longer -
e
is 1 byte longer -
i
is new (1 byte) -
B
is new (2 bytes) - Stack is 2 bytes shorter