cc2538: Add configuration for firmware location

Introduce FLASH_CONF_FW_ADDR and FLASH_CONF_FW_SIZE in order to make it
possible to place the firmware anywhere, regardless of Coffee, and
without having to write a custom linker script. Also, handle the default
values properly in order to fix the link breakage reported by
Arthur Fabre <arthur@arthurfabre.com> with COFFEE_CONF_CUSTOM_PORT.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
ico
Benoît Thébaudeau 2016-06-19 22:57:36 +02:00
parent a8989f9f1c
commit 8a273a248e
2 changed files with 19 additions and 2 deletions

View File

@ -35,8 +35,7 @@
*/
MEMORY
{
FLASH_FW (rx) : ORIGIN = COFFEE_START + COFFEE_SIZE,
LENGTH = FLASH_CCA_ADDR - (COFFEE_START + COFFEE_SIZE)
FLASH_FW (rx) : ORIGIN = FLASH_FW_ADDR, LENGTH = FLASH_FW_SIZE
FLASH_CCA (RX) : ORIGIN = FLASH_CCA_ADDR, LENGTH = FLASH_CCA_SIZE
/*

View File

@ -48,6 +48,7 @@
#define FLASH_H_
#include "dev/cc2538-dev.h"
#include "cfs-coffee-arch.h"
#include <stdint.h>
/*---------------------------------------------------------------------------*/
@ -90,6 +91,23 @@
#define FLASH_CCA_LOCK_DEBUG_BIT 7 /**< Debug lock bit position in the corresponding lock byte */
/** @} */
/*---------------------------------------------------------------------------*/
/** \name Firmware location in flash memory
* @{
*/
#ifdef FLASH_CONF_FW_ADDR
#define FLASH_FW_ADDR FLASH_CONF_FW_ADDR
#elif !defined(COFFEE_CONF_CUSTOM_PORT)
#define FLASH_FW_ADDR (COFFEE_START + COFFEE_SIZE)
#else
#define FLASH_FW_ADDR CC2538_DEV_FLASH_ADDR
#endif
#ifdef FLASH_CONF_FW_SIZE
#define FLASH_FW_SIZE FLASH_CONF_FW_SIZE
#else
#define FLASH_FW_SIZE (FLASH_CCA_ADDR - FLASH_FW_ADDR)
#endif
/** @} */
/*---------------------------------------------------------------------------*/
/** \name Flash lock bit page and CCA layout
* @{
*/