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
  • Hi,

    Most emac driver and usb stacks require buffers. Because these communication are fast it's often a good idea to put these buffers in the SRAM.
    So for example bank 0 would be for the USB stack and bank 1 for the ethernet driver.

    I would store my configuration data in a section of the iRAM myself but there is no rule that says you have too use this setup.

    You are correct in your explanation of the linker memory section usage. However the only reason to add a memory section to the target tab is so the linker can use it.

    For example I add bank 0 and bank 1 and I change the individual file options for my emac and USB source file to use these locations for RAM.

    I'm not sure what you are doing but you may want to consider reserving a section of iRAM that the linker can not use.

    TARGET TAB

    • RAM1 0x1000 0000 - 0x1000 5FFF (for stack, globals...) NOTE end address!
    • RAM2 0x2007 C000 - 0x2007 FFFF (for USB)
    • RAM3 0x2008 0000 - 0x2008 3FFF (for ethernet)

    Then in your code add a block of memory at 0x10006000 for your data.

Reply
  • Hi,

    Most emac driver and usb stacks require buffers. Because these communication are fast it's often a good idea to put these buffers in the SRAM.
    So for example bank 0 would be for the USB stack and bank 1 for the ethernet driver.

    I would store my configuration data in a section of the iRAM myself but there is no rule that says you have too use this setup.

    You are correct in your explanation of the linker memory section usage. However the only reason to add a memory section to the target tab is so the linker can use it.

    For example I add bank 0 and bank 1 and I change the individual file options for my emac and USB source file to use these locations for RAM.

    I'm not sure what you are doing but you may want to consider reserving a section of iRAM that the linker can not use.

    TARGET TAB

    • RAM1 0x1000 0000 - 0x1000 5FFF (for stack, globals...) NOTE end address!
    • RAM2 0x2007 C000 - 0x2007 FFFF (for USB)
    • RAM3 0x2008 0000 - 0x2008 3FFF (for ethernet)

    Then in your code add a block of memory at 0x10006000 for your data.

Children