Using the additional 2kB of RAM on LPC131x / LPC134x MCUs
Posted: Mon Sep 30, 2013 1:28 pm
LPC131x/134x MCUs with 10kB of more of SRAM are similar to LPC175x/176x MCUs in that the SRAM is not in one contiguous block. The main CPU SRAM is 8kB and the separate SRAM1 and USB SRAM blocks are 2kB each.
When you use the default Astrobe Linker options your application will only use the 8kB of CPU SRAM. If you change the Heap Start and Heap Limit settings on the Linker options you can use one of the additional 2kB blocks for dynamic memory (Oberon POINTER variables). Because this frees up CPU RAM for data and stack space you can then use more / larger global and local variables in your application.
To demonstrate this run the attached example program on an LPC171x/173x MCU. Run it the first time with the default Linker Option settings and then run it again using the Heap Start / Heap Limit values for your MCU as shown in the header comments. The example also includes a function EnableRAM which is required to set the appropriate bits in the SYSAHBCTRL register to turn on the SRAM1 or USB SRAM clocks.
When you use the default Astrobe Linker options your application will only use the 8kB of CPU SRAM. If you change the Heap Start and Heap Limit settings on the Linker options you can use one of the additional 2kB blocks for dynamic memory (Oberon POINTER variables). Because this frees up CPU RAM for data and stack space you can then use more / larger global and local variables in your application.
To demonstrate this run the attached example program on an LPC171x/173x MCU. Run it the first time with the default Linker Option settings and then run it again using the Heap Start / Heap Limit values for your MCU as shown in the header comments. The example also includes a function EnableRAM which is required to set the appropriate bits in the SYSAHBCTRL register to turn on the SRAM1 or USB SRAM clocks.