1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/cc2538/Makefile.include
Francisco Molina ab9abf2f51
cpu/cc2538: add riotboot
Flash Customer Configuration Area (CCA) is never written when the
riotboot module is used. This required a riot application to have
been previously flashed. riotboot will completely ignore this
section, neither writing or erasing it.

Slot flashing is currenly only supported with Jlink.

Co-authored-by: Brenton Chetty <brent7984@gmail.com>
2020-11-13 14:51:57 +01:00

47 lines
1.3 KiB
Makefile

# Strip 'K' from ROM_LEN definition
_rom_len_k = $(shell echo $1 | sed 's/K//')
# Set ROM and RAM lengths according to CPU model
ifneq (,$(filter cc2538nf11,$(CPU_MODEL)))
ROM_LEN ?= 128K
RAM_LEN ?= 16K
endif
ifneq (,$(filter cc2538nf23,$(CPU_MODEL)))
ROM_LEN ?= 256K
RAM_LEN ?= 32K
endif
ifneq (,$(filter cc2538nf53 cc2538sf53,$(CPU_MODEL)))
ROM_LEN ?= 512K
RAM_LEN ?= 32K
endif
# If using riotboot subtract 2 pages (2 * 2K) to not write over CCA
# section and keep page parity (so slots are split evenly among pages)
ifneq (,$(filter riotboot,$(FEATURES_USED)))
ROM_LEN := $(shell echo $$(( $(call _rom_len_k,$(ROM_LEN)) - 4 )) )K
endif
# Set ROM and RAM start address
ROM_START_ADDR ?= 0x00200000
RAM_START_ADDR ?= 0x20000000
# Set CFLAGS
KB := 1024
FLASHSIZE := $(shell echo $$(( $(call _rom_len_k,$(ROM_LEN)) * $(KB))) )
CFLAGS += -DCC2538_FLASHSIZE=$(FLASHSIZE)U
# Use common ld script
LINKER_SCRIPT ?= cc2538.ld
# The entry point `cortex_vector_base` is defined in the cca field.
# If the cca field is updated when flashing a slot then the entry
# point will never be the bootloader but the respective slot. This
# ensures it never happens, the last page will never be touched when
# using riotboot.
ifneq (,$(filter riotboot,$(FEATURES_USED)))
CFLAGS += -DUPDATE_CCA=0
endif
include $(RIOTMAKE)/arch/cortexm.inc.mk