Tool/software: Code Composer Studio
Hello,
I would like to first mention that my knowledge of CCS is still quite new, however I am currenty trying to implement the main function from an example code named nvsexternal.c from the TI Resource Explorer into the a modified version of the code also from the resource explorer named "simple_broadcaster" that reads, writes, and erases the external memory on a TI-CC2640 using the SPI. I was successfully able to run both programs seperately beforehand, but now upon inserting this SPI function into my main code, I am recieving this error:
"program will not fit into available memory. placement with alignment fails for section ".TI.bound:NV_FLASH" size 0x1000 , overlaps with ".TI.bound:flashBuf$9", size 0x4000 (page 0) null: program will not fit into available memory. placement with alignment fails for section ".TI.bound:NV_FLASH" size 0x1000 , overlaps with ".TI.bound:flashBuf$9", size 0x4000 (page 0) "
Here is the main function for the spi:
/******************************************************************
* Defines (nvsexternal.c)
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
/* Driver Header files */
#include <ti/display/Display.h>
#include <ti/drivers/NVS.h>
/* Example/Board Header files */
#include "Board.h"
#define FOOTER "=================================================="
/* Buffer placed in RAM to hold bytes read from non-volatile storage. */
static char buffer[16];
static const char signature[] =
{"SimpleLinktest..."};
/*********************************************************************
void nvs_func(void)
{
NVS_Handle nvsHandle;
NVS_Attrs regionAttrs;
NVS_Params nvsParams;
Display_Handle displayHandle;
/*
* Wake up external flash on LaunchPads. It is powered off by default
* but can be turned on by toggling the SPI chip select pin.
*/
#ifdef Board_wakeUpExtFlash
Board_wakeUpExtFlash();
#endif
Display_init();
NVS_init();
displayHandle = Display_open(Display_Type_UART, NULL);
if (displayHandle == NULL) {
/* Display_open() failed */
while (1);
}
NVS_Params_init(&nvsParams);
nvsHandle = NVS_open(Board_NVSEXTERNAL, &nvsParams);
if (nvsHandle == NULL) {
Display_printf(displayHandle, 0, 0, "NVS_open() failed.");
return;
}
Display_printf(displayHandle, 0, 0, "\n");
/*
* This will populate a NVS_Attrs structure with properties specific
* to a NVS_Handle such as region base address, region size,
* and sector size.
*/
NVS_getAttrs(nvsHandle, ®ionAttrs);
/* Display the NVS region attributes. */
Display_printf(displayHandle, 0, 0, "Sector Size: 0x%x",
regionAttrs.sectorSize);
Display_printf(displayHandle, 0, 0, "Region Size: 0x%x\n",
regionAttrs.regionSize);
/*
* Copy "sizeof(signature)" bytes from the NVS region base address into
* buffer.
*/
NVS_read(nvsHandle, 0, (void *) buffer, sizeof(signature));
/*
* Determine if the NVS region contains the signature string.
* Compare the string with the contents copied into buffer.
*/
if (strcmp((char *) buffer, (char *) signature) == 0) {
/* Write buffer copied from flash to the console. */
Display_printf(displayHandle, 0, 0, "%s", buffer);
Display_printf(displayHandle, 0, 0, "Erasing SPI flash sector...");
/* Erase the entire flash sector. */
NVS_erase(nvsHandle, 0, regionAttrs.sectorSize);
}
else {
/* The signature was not found in the NVS region. */
Display_printf(displayHandle, 0, 0, "Writing signature to SPI flash...");
/*
* Write signature to memory. The flash sector is erased prior
* to performing the write operation. This is specified by
* NVS_WRITE_ERASE.
*/
NVS_write(nvsHandle, 0, (void *) signature, sizeof(signature),
NVS_WRITE_ERASE | NVS_WRITE_POST_VERIFY);
}
Display_printf(displayHandle, 0, 0, "Reset the device.");
Display_printf(displayHandle, 0, 0, FOOTER);
return;
}
/****************************************************************************
Here is also the memory allocation from the simple_broadcaster.c file:
I had previously tried reducing the size of my code overall, and removing the display_print functions with the thought of it being simply too large of a program, but as of now I am not sure where to begin with fixing this problem. Any guidance towards this issue would be greatly appreciated.
If there is anything else I can provide to help, I can do so gladly :)
Thanks!
-Steven