Author Topic: RAM Layout in the LPC2XXX project  (Read 3003 times)

Online mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3093
    • View Profile
    • uTasker
RAM Layout in the LPC2XXX project
« on: June 07, 2011, 05:05:02 PM »
Hi All

This note is to go with the version V1.4-5 of the LPC2XXX project. It concerns the way that RAM is used (specifically the top of RAM where the interrupt stacks are located).

The background to this is the fact that the various projects for the LPC2XXX were not all configured identically and the the laterst utasker proejcts standardise the way that the simple random number generator works - requiring an uninitialised SRAM location of the random number seed.

The LPC2XXX are also a little special due to the fact that the chip has IAP (In Application Programming) which makes use of up to 32 bytes of SRAM at the top of memory. Some of the project configurations reserved these 32 bytes and some not - in fact, due to the fact that the top of SRAM is used for interrupt stack and the fact that IAP and interrupt are never operatrion together thsi was not really important.

However in the V1.4-5 version I have been careful that all LPC2XXX projects (that is the demo project, the serial loader and the boot loader for all compiler targets) use the same technique, which is as follows:

1 - 32 bytes of SRAM is always reserved for the IPA. The top of all used SRAM is therefore 32 bytes below the top of physical SRAM.
2 - Below the 32 bytes IAP SRAM a further 4 bytes are reserved for a random number seed. This is a fixed location for all processor types and stack configurations so the define EXCEPTION_STACK_SIZE, which may have been configured before to suit stack configuration, has been removed.
3 - Under the random number seed location (presumed to be a random(ish) number after a power up and always incremented by the PRNG (Pseudo Random Number Generator) when used and also between warm resets) are normal stacks - usually ISR, FIQ etc. The set up of these stacks no longer has any influence on the random-number seed location.

That was it - all configurations should now respect this - and otherwise there should be no noticeable differences. It is simply advised to check out the linker scripts in the new version whcih have been modified to suit.

Regards

Mark