Reserve ROM area in linker

hi,

i'm using RX66T on a e2studio Version: 2022-04 (22.4.0) with CC-RX compiler

is there a way to reserve a certain area of ​​the ROM so that the linker does not insert any variables to the addresses in the range?

  • Would an assembly code work for you?

       .SECTION B,ROMDATA

        .ORG  02000H

        .LWORD    100H

        .END

  • You don't mention which compiler that you are using (GCC or CC-RX), but the linker section definitions can control memory allocation.  GCC is probably easier to manage in this regard, there is a LD file that can be edited:

    There are many references online for GCC, the LD file format is the same for all architectures.

    CC-RX is a bit less straight forward in my opinion, the linker uses the DVF device file for linker section placement by default, there are ways to override and change these settings, you would have to read the docs for this tool and play around with the linker to figure it out.

  • if I try to create an asm file and insert your code the linker reports me this error:

    W0561323:Section attribute mismatch : "B"
    W0561322:Section alignment mismatch : "B"
    W0561121:Address cannot be assigned to absolute section "B" in start option
    E0562321:Section "B" overlaps section "B_1"

    not sure if B is the correct section and the address (02000H) seems to me a RAM address

    these are my sections:

    I want to reserve the addresses: 0xFFF81000 and 0xFFF81001 so that no constants or functions are allocated to these addresses.

    I want to not even assign a dummy value to these addresses, so as not to have this dummy value in the .mot file

  • If you already start your section at 0xFFF80010, as far as this project is concern, 0xFFF80000~0xFFF8000F doesn't exist.  Isn't this what you want?

    You choose the start of ROM.  If you want to make a middle section disappear, 

    ROM = 0xFFF80000 - 0xFFF8FFFF

    ROM2=0xFFF90010 - 0xFFFFFFFF

    use cpu = stride so the middle section is un-assigned.

    From ccrx manual

    .section C, ROMDATA     B is for RAM. C=constant.

  • true, by setting the starting address of PResetPRG to 0xFFF80010 in the 0xFFF80000-0xFFF8000F section, nothing is inserted.

    as for the exclusion of a central section, thanks to "CS YEP" suggestion I found a quick way to do the operation:

    suppose you want to exclude section 0xfff80100-0xfff801ff:

    I do a build of the project with default settings.
    in the console I copy the command line, in particular the parameter -CPU = ...

    in Project - C/C++ Project settings - Linker - Section - Advanced

    Memory address type assignment method: select "User specify"

    Press ADD

    paste the previously copied string, for example:

    RAM=00000000-0000ffff,FIX=00080000-00083fff,FIX=00086000-00087fff,FIX=00088000-0009ffff,FIX=000a0000-000a3fff,FIX=000a6000-000bffff,FIX=000c0000-000dffff,FIX=000e0000-000fffff,ROM=00100000-00107fff,RAM=00120040-0012007f,FIX=007fb174-007fb177,FIX=007fb17c-007fb17f,FIX=007fb1e4-007fb1eb,FIX=007fe000-007fffff,RAM=00ffc000-00ffffff,ROM=fff80000-ffffffff

    changing the lastest ROM address as needed: 

    RAM=00000000-0000ffff,FIX=00080000-00083fff,FIX=00086000-00087fff,FIX=00088000-0009ffff,FIX=000a0000-000a3fff,FIX=000a6000-000bffff,FIX=000c0000-000dffff,FIX=000e0000-000fffff,ROM=00100000-00107fff,RAM=00120040-0012007f,FIX=007fb174-007fb177,FIX=007fb17c-007fb17f,FIX=007fb1e4-007fb1eb,FIX=007fe000-007fffff,RAM=00ffc000-00ffffff,ROM=fff80000-fff800ff,ROM=fff80200-ffffffff

    notice the change of ROM=fff80000-ffffffff into ROM=fff80000-fff800ff,ROM=fff80200-ffffffff