Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC1310: Save struct in flash memory

$
0
0

Part Number:CC1310

Hi,

In another product I made, I have declared a section in the linker to be able to "send" some informations from the application to the bootloader program. As follows:

SECTIONS
{
.text :
{
// Content removed to save post space
} > FLASH = 0xFF

.boot_info_section 0x7F800:
{
KEEP(*(.boot_info_section*))
} > FLASH

// Content removed to save post space
}

The struct is that one:

typedef struct __attribute__((packed)){
u8 magic_word[4];
u32 bin_size;
u32 bin_addr;
u32 error_status;
} boot_info_t;

And in the bootloader I have:

#define BOOT_INFO_SECTION_ADDRESS 0x7F800
const boot_info_t * boot_info = (boot_info_t *)BOOT_INFO_SECTION_ADDRESS;

I would like to do the same thing in the CC1310 as well.

Today my linker looks like this:

/* The starting address of the application. Normally the interrupt vectors */
/* must be located at the beginning of the application. */
#define FLASH_PAGE_SIZE 4096

#define FLASH_BASE 0x7000
#define FLASH_SIZE (FLASH_PAGE_SIZE * 25)
#define RAM_BASE 0x20000000
#define RAM_SIZE 0x5000

/* System memory map */

MEMORY
{
/* Application stored in and executes from internal flash */
FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
/* Application uses internal RAM for data */
SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
}

/* Section allocation in memory */

SECTIONS
{
.text : > FLASH
.const : > FLASH
.constdata : > FLASH
.rodata : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.emb_text : > FLASH
.ccfg : > FLASH (HIGH)

#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
.TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
#endif
#endif
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM (HIGH)
.nonretenvar : > SRAM
}

I am trying to insert a similiar thing as ".boot_info_section 0x7F800: { KEEP(*(.boot_info_section*)) } > FLASH", but I can't compile it.

Can someone help with the correct way to do that?

Also, I need to define a known and SAFE (no conflict with RTOS objects) address in flash to save it.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>