Jump to content


Recommended Posts

Easy way is to define a pair of arrays in the ".text" section I believe, declared of the appropriate size. I'm not sure which compiler you're using so I don't know how to declare the correct section. Another cheat is to lie to the compiler stating your array is "const" but then declare a pointer of similar datatype (and is not declared const) which points to that array. Then let the compiler find enough room for it.


Sent from my Galaxy Note 10.1

Link to post
Share on other sites

The "clean" way to solve this is to define an array in your code that will hold the data. Because the size exceeds the RAM capacity of the device, things get a bit complicated. @@spirilis' approach works (and I've used it before) but you do have to finesse const validation.


The "clean" way is to define a new linker section and tell the compiler to put the array into that section. Here's part of a patch that does this for a large display buffer, assuming you're using Code Composer Studio:


diff --git a/430BOOST-SHARP96_GrlibDisplay/LcdDriver/Sharp96x96.c b/430BOOST-SHARP96_GrlibDisplay/LcdDriver/Sharp96x96.c
index eddcf43..b2f1845 100755
--- a/430BOOST-SHARP96_GrlibDisplay/LcdDriver/Sharp96x96.c
+++ b/430BOOST-SHARP96_GrlibDisplay/LcdDriver/Sharp96x96.c
@@ -46,6 +46,7 @@
 #include "../driverlibHeaders.h"
 #include "inc/hw_memmap.h"
+#pragma DATA_SECTION(DisplayBuffer, ".fram_data")
 unsigned char DisplayBuffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX/8];
 unsigned char VCOMbit= 0x40;
 unsigned char flagSendToggleVCOMCommand = 0;

diff --git a/430BOOST-SHARP96_GrlibDisplay/lnk_msp430fr5969.cmd b/430BOOST-SHARP96_GrlibDisplay/lnk_msp430fr5969.cmd
index 1c19b99..1b47735 100644
--- a/430BOOST-SHARP96_GrlibDisplay/lnk_msp430fr5969.cmd
+++ b/430BOOST-SHARP96_GrlibDisplay/lnk_msp430fr5969.cmd
@@ -136,6 +136,7 @@ SECTIONS
           .cio        : {}                   /* C I/O BUFFER                      */
           .sysmem     : {}                   /* DYNAMIC MEMORY ALLOCATION AREA    */
+          .fram_data   : {}                  /* Stuff that won't fit in RAM       */
        } ALIGN(0x0400), RUN_START(fram_rw_start)
Other toolchains support the same concept but may use a different pragma or linker-script edit.


You can put multiple objects in the same linker section, if you need to add more data in the future.

Link to post
Share on other sites

If you use CCS, [your_project_name].map will tell you how your memory is allocated.

You can also tell CCS to create flash image and see what and where will be loaded to memory.

Finally, you could just declare a constant ( const char myMem[0x3100] = {0, }; ) and get it's address (&myMem)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...