This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CODE space allocation

I have a project which has a large ROM, of which only 8KBytes is visible to the CPU.

The rest of the ROM is accessed by a custom memory scheme.

I want to ensure that all the CODE in the ROM resides in the bottom 8KBytes so it can be seen by the CPU, with the rest if the ROM conatining data.

The _at_ directive (etc) is too inflexable - I want the data to follow on immediately after the code.

How can I do this?

Thanks in advance,

Gary

Parents
  • I want to ensure that all the CODE in the ROM resides in the bottom 8KBytes so it can be seen by the CPU, with the rest if the ROM conatining data.

    Actually, this can be done using the CODE directive. You can specify the order in which segments are lined. Furthermore, you can specify wildcards for the segment names.

    If you name the files that include your code segments with a prefix you can use a wildcard version of that when you link. For example, if I put all of my constant segments in files named CONST_*.C the resulting segment names would be ?CO?CONST_*. To link these at the end of your program memory, you could specify something like...

    bl51 ... code(0x0000-0x1FFFF, ?C_*, ?PR?*, ?CO?CONST_* (0x1000))

    This specifies that there is exactly 8K of code space and that compiler segments like startup code and so on (?C_*), program segments (?PR?*) are linked in that order. Then, segments named ?CO?CONST_* are linked starting at address 0x1000.

    If you simply want to link ALL code segments, you can just use ?CO?* as the segment wildcard.

    In uVision2, you can specify the address range for the code memory under Options for Target - Target - Off-chip Code Memory.

    You can specify the code segments under Options for Target - BL51 Locate - Code. Here you only need to specify the order for the segments which is ?C_*, ?PR?*, ?CO?CONST_* (0x1000) in my example.

    Hopefully this helps.

    Jon

Reply
  • I want to ensure that all the CODE in the ROM resides in the bottom 8KBytes so it can be seen by the CPU, with the rest if the ROM conatining data.

    Actually, this can be done using the CODE directive. You can specify the order in which segments are lined. Furthermore, you can specify wildcards for the segment names.

    If you name the files that include your code segments with a prefix you can use a wildcard version of that when you link. For example, if I put all of my constant segments in files named CONST_*.C the resulting segment names would be ?CO?CONST_*. To link these at the end of your program memory, you could specify something like...

    bl51 ... code(0x0000-0x1FFFF, ?C_*, ?PR?*, ?CO?CONST_* (0x1000))

    This specifies that there is exactly 8K of code space and that compiler segments like startup code and so on (?C_*), program segments (?PR?*) are linked in that order. Then, segments named ?CO?CONST_* are linked starting at address 0x1000.

    If you simply want to link ALL code segments, you can just use ?CO?* as the segment wildcard.

    In uVision2, you can specify the address range for the code memory under Options for Target - Target - Off-chip Code Memory.

    You can specify the code segments under Options for Target - BL51 Locate - Code. Here you only need to specify the order for the segments which is ?C_*, ?PR?*, ?CO?CONST_* (0x1000) in my example.

    Hopefully this helps.

    Jon

Children