Menu

#194 absolute addressing

open
None
5
2007-01-16
2007-01-16
SRBreaky
No

When you use absolute adressing of __code in the way

__code __at (0xC000) short array[10]={ 1,27,38...

the values/code should also be written to the hex-output.

Thank you.

Discussion

  • Raphael Neider

    Raphael Neider - 2007-01-16

    Logged In: YES
    user_id=1115835
    Originator: NO

    I guess you are requesting this for the pic14 backend?
    At least, there it is not working as it should right now.

    I will have a look at it.

    Regards,
    Raphael

     
  • Raphael Neider

    Raphael Neider - 2007-01-16
    • assigned_to: nobody --> tecodev
     
  • Nobody/Anonymous

    Logged In: NO

    Hi Raphael,
    i'm requesting this for the C8051F133 from SiLabs. Problem is that i use the flash of the C8051F133 for saving some settings. To save my program code i have to disable reads and writes to the flash, but these registers have to be disabled too. The C8051F133s flash has only 4 banks each 16 kbyte. So i have to disable 0x000-0x7FFF and 0xC000-0xFFFF. My code is less than 32kbyte but with all tables (that are also in code area) its more than 32kbyte. because of this i would like to put some tables at 0xC000-0xFFFF. And i don't know how to do this within just one Hex-File. I hope i explained this good enough and sorry for my bad english.

     
  • Maarten Brock

    Maarten Brock - 2007-01-16

    Logged In: YES
    user_id=888171
    Originator: NO

    The SDCC mcs51 target already has this implemented in the latest snapshot.
    The C8051F133 has only 2 banks and they are 32kB.
    I don't understand what you mean by disabling registers or disabling reads and writes to the flash.

    Raphael, do you want to keep this RFE open for the pic14? Otherwise please close it.

    Maarten

     
  • Nobody/Anonymous

    Logged In: NO

    I'm sorry but the C8051F133 has 4 Banks and they are 16kByte (Page 205, Figure 15.3 of the C8051F133 Data Sheet).

    But thank you for the hint. The snapshot version does what i need.
    So i don't need to bother you with my problem.

     
  • Maarten Brock

    Maarten Brock - 2007-01-16

    Logged In: YES
    user_id=888171
    Originator: NO

    Those aren't banks, they are memory blocks for the JTAG flash lock bytes. The banks are described on page 201, fig. 15.1.

    Why not lock the whole flash for JTAG access and only write to flash from software? Do you really save your settings from the PC using the JTAG connection?

    To limit the area where your program can write use FLACL.

     
  • Nobody/Anonymous

    Logged In: NO

    Sorry that i talked about "banks" and not "blocks".

    You are right, i don't save the settings from the pc via jtag, but:

    at page 203 they write "to ensure protection from external access, the block containing the lock bytes must be write/erase locked...on the C8051F133 the block containing the the security bytes is 0xC000-0xFFFF...if the page containing the security byte is not write/erase locked, it is still possible to erase this page of flash memory through jtag port and reset the security bytes"

    So i have to lock 0xC000-0xFFFF. For my settings i have to use 0x8000-0xBFFF and
    cos of this my program code has to be less than 32kByte. And that's why i need to put my constant arrays to 0xC000-0xFFFF to save space for program code.

    Maybe i didn't understand all things but i don't see a way to protect my code from writing/reading through jtag and still allowing writing/reading through program code.

     
  • Maarten Brock

    Maarten Brock - 2007-01-16

    Logged In: YES
    user_id=888171
    Originator: NO

    You may lock the whole flash from 0x0000 to 0xFFFF for both read and write access through JTAG.
    This means you can no longer debug your code nor access the settings using the debug adapter. This is what they mean by 'external access'. You can only do a full erase to unlock the flash again.

    But locking has no effect on what the application inside the mcu can do with the flash contents. That is limited by the contents of FLACL. It uses much smaller blocks of 512 bytes. That's even smaller than the flash sector/page size of 1024 bytes. You can put the constant array almost anywhere, but typically on a 1kB boundary and above your application.

    To make the story complete, if you locate the array using __code __at() with the latest snapshot your application can still occupy both memory before and after the array. So if you place it at 0x8000 your application is not limited to 32kB.

     
  • Nobody/Anonymous

    Logged In: NO

    Yes, i already downloaded the snapshot and it works fine.
    And thank you very much for explaining the C8051F133.
    I will try it.

     

Log in to post a comment.