c - MSP430 Ram Overflow -


the msp430g2553 has 512 bytes of ram 16kb of flash memory. on microcontroller, static/global variables assigned in ram under .bss section. local variables assigned in ram under .stack section. dynamically allocated memory variables (malloc) assigned in ram under .sysmem section.

i have need msp430 keep track of connected devices via wifi. have struct such:

struct dev {     char type[20];     char ipaddress[13];     char name[20];     char status[1]; }; 

this struct takes 54 bytes of memory each device. planning on having 20+ devices connected msp430 , need have 20 of these structs. 20 x 54 bytes = 1080 bytes. big 512 bytes of ram.

is there way write these structs flash since have 16kb of memory use? understanding of flash variables read-only. these structs getting assigned read-write , not sure if possible.

i don't quite understand why ti make device has 16 kb flash , 512 bytes of ram, when variables requiring read-write operations stored in ram. seems waste of space.

i have tried change these sections .bss/.stack/.sysmem flash in linker file , msp430 not run this. have tried change size of ram , in linker file , change memory locations adding 512 bytes, not run either.

do have options here?

yes, can write data flash memory. problem arises when want change data. can erase sectors, have size of 512 bytes. take 2 flash sectors flash , store data 10 devices in each sector. flash can read ram though, don't need kind of swapping code, address each device entry pointer. last problem flash memory has limit of erase cycles, here around 10000 cycles. might have write code distribute data different sectors on time, depending on amount of expected changes , desired service durability.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -