1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/stm32f7/Makefile.include
Francisco Molina dc958b3b38 stm32f7/Makefile.include: add riotboot requirements
- stm32f7 use sectors instead of pages, they go either from 16KB to
  128KB, or from 32KB to 25KB. Smaller sectors are at the begining of
  the flash. Slots must start at the begining of a sector to not overlap.
- Minimum required RIOBOOT_HDR_LEN or stm32f7 is 0x200
  to respect vector table alignment
- Add CPU_FLASH_BASE
2019-08-07 18:37:07 +02:00

29 lines
1.2 KiB
Makefile

export CPU_ARCH = cortex-m7
export CPU_FAM = stm32f7
# STM32F7 uses sectors instead of pages, where the minimum sector length is 16KB or
# 32kB (the first sector), depending on the CPU_MODEL. Therefore RIOTBOOT_LEN must
# be 16KB or 32kB to cover a whole sector.
ifneq (,$(filter stm32f722ze ,$(CPU_MODEL)))
RIOTBOOT_LEN ?= 0x4000
else
RIOTBOOT_LEN ?= 0x8000
endif
# CPU_IRQ_NUMOF for STM32F7 boards is < 110+16 so (126*4 bytes = 504 bytes ~= 0x200)
# RIOTBOOT_HDR_LEN can be set to 0x200.
# Details on alignment requirements for M4 in `cpu/cortexm_common/Makefile.include`.
RIOTBOOT_HDR_LEN ?= 0x200
# Sectors don't have the same length. Per bank there can be up to 12 sectors. If
# the smallest sector size is 16kb the first 4 sectors are 16kB long, the 5th is
# 64kB and the remaining 7 are 128kB. Since flash can only be erased by sector,
# slots can't overlap over sectors.
# RIOTBOOT_LEN is removed twice, once at the start of the flash for the bootloader,
# and a second time at the end of the flash, to get evenly sized and distributed slots.
SLOT0_LEN ?= $(shell printf "0x%x" $$((($(ROM_LEN:%K=%*1024)-2*$(RIOTBOOT_LEN)) / $(NUM_SLOTS))))
SLOT1_LEN ?= $(SLOT0_LEN)
include $(RIOTCPU)/stm32_common/Makefile.include
include $(RIOTMAKE)/arch/cortexm.inc.mk