Fill ROM section with "nop" instruction in CC-RX

Hi everybody,

I have the following situation for my project compiled via CC-RX v3.05.00:

1. I created a specific section (in this case I named it "safetyROM") using "linker" sections settings (for more details see this thread)

Specific address location for RAM variable in RX140 - Forum - RX MCU - Renesas Community

2. I specify the size for the specific section "safetyROM" to a value of, let's say, 8KB (i.e. 8192bytes) from address 0xFFFF1000 to 0xFFFF3000.

3. I put part of my code to this section using "#pragma section P SafetyROM" compiler instruction.

So far so good....

Now, If I check the "memory usage" view (see attached image), the section doesn't fill the entire segment 0xFFFF1000-0xFFFF3000,but only a part of it (in this case 4317bytes): the result is expected.

However, I would like to fill the rest of the section (i.e. up to address 0xFFFF3000) with "NOP" instruction.

QUESTION: is there a #pragma to instruct the compiler to fill the rest of the section with a specific content?

I remember that COSMIC compiler for STM8 devices comprises such a possibility and it would be great to have also on CC-RX compiler.

Many thanks for support and regards

  • I believe the "space" linker option will do what you need.

    Or perhaps the "padding" options would suffice:

    Typically filling executable areas with NOP instructions is not recommended, as a program that jumps to unexpected areas would prefer to be trapped by something like an illegal opcode.

  • Hello @JimB,

    I checked "-padding" option but I don't think it does what I'm looking for.

    I found "space" option on the manual but I forgot to mention in my previous post that I didn't find it on e2studio (I tried to search on [Properties]->[C/CC++ Build]->[Settings]->[Linker] ).

    I tried to add "-space" option in "user-defined options(added before all specified options" in various manners, such as




    -space={0 | 0}

    -space={FFFF1000-FFFF2FFF |0}


    but none of them works. Generally I got "invalid parameter" error or  the .mot output file doesn't have the filled address.

    Is it possible to have an example of the "space" option or some documentation which explain how to use it?

    Moreover, I would like only to fill one particular section (possibly).

    Thanks and regards

    PS: Thanks for suggesting to not use "NOP" instruction.

  • Do you satisfy the highlighted constraint:

Reply Children
  • Hello @JimB,

    Finally I was able to "partially" solve my request.

    I added the "-space" option in "Converter" menu of e2studio

    [Properties]->[C/CC++ Build]->[Settings]->[Tool Settings TAB]->[Converter]->[User MENU]

    It correctly adds to ".mot" file the S-lines with filling "AA" (value choosed just to test) in the unused area.

    Unfortunately it added to ALL flash, not only to the section I would like to fill (in my case the unused space of addresses between FFFF1000 and FFFF2FFF).

    At moment I think it's OK; maybe it maybe improved with more complex subcommand ".sub" file for rlink command.

    Moreover, on debbuger configuration it is necessary to setup the ".mot" on STARTUP menu otherwise the .x file doesn't contain the filling area.

    Thanks and regards