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

LPC1768 how to Reserve 4K of SRAM to store data

Hi all

I'm learning to program uC's on by myself, and I'm using the MCB1700, now I have some doubts.

for example, How can I reserve SRAM space memory for storing data? what I want is to have for example 4 KB of memory to store data, from one memory location known and fixed, and no access to it except the data I want to store and read to and from it.

I am currently trying both ways, but I'm not absolutely convinced that this work or playing well, are as follows:

- 4 KB array, starting at position 0x20080000.

Unsigned char my_sram_sector [0x4000] __attribute__ ((section (". ARM.__at_0x20080000"), zero_init));

or

- In Options for Target 'FLASH' in Target tab

in Read/Write Memory Areas

default off-chip Start Size NoInit
selected RAM1: 0x2008000 0x4000 Selected
Not Selected RAM2:
Not Selected RAM3:

default off-chip Start Size NoInit
selected IRAM1: 0x10000000 0x8000 Not Selected
Not Selected IRAM2: 0x2007C000 0x4000 Not Selected

Could this be a correct way?

And if I want to store in the 4 KB data structures, how could I do it?

thanks in advance and forgive my English

Parents
  • Everything under the Options for Target 'FLASH' in Target tab is used by the linker during 'scatter loading'

    If you want a section of memory that would not be used by the linker, gernerally you should not include it under these settings.

    (btw. SRAM at this location is generally used for USB and Ethernet peripherals)

    In your case just remove the RAM section from this tab all together and use your

    Unsigned char my_sram_sector [0x4000] __attribute__ ((section (". ARM.__at_0x20080000"), zero_init));
    

    or if you just want a pointer this is more portable:

    Unsigned char * my_sram_sector = (Unsigned char *)0x20080000;
    

    Hope this helps.

Reply
  • Everything under the Options for Target 'FLASH' in Target tab is used by the linker during 'scatter loading'

    If you want a section of memory that would not be used by the linker, gernerally you should not include it under these settings.

    (btw. SRAM at this location is generally used for USB and Ethernet peripherals)

    In your case just remove the RAM section from this tab all together and use your

    Unsigned char my_sram_sector [0x4000] __attribute__ ((section (". ARM.__at_0x20080000"), zero_init));
    

    or if you just want a pointer this is more portable:

    Unsigned char * my_sram_sector = (Unsigned char *)0x20080000;
    

    Hope this helps.

Children