1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #17686 from benpicco/cpu/sam0_common-info.mk

cpu/saml21: derive low power SRAM length from model number
This commit is contained in:
Dylan Laduranty 2022-02-22 00:48:36 +01:00 committed by GitHub
commit 38943b7051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 3 deletions

View File

@ -0,0 +1,14 @@
# Extract SAM0 infos from CPU_MODEL
# Example for saml21e15b
# - SAM0_FAMILY: l
# - SAM0_SERIES: 21
# - SAM0_PINCNT: e (32 Pins)
# - SAM0_DENSITY: 15 (32k Flash)
# - SAM0_VARIANT: b (release stepping)
SAM0_INFO := $(shell echo $(CPU_MODEL) | sed -E -e 's/^sam(d|e|l|r)([0-9][0-9])([a-z])([0-9][0-9])(.)?/\1 \2 \3 \4 \5/')
SAM0_FAMILY := $(word 1, $(SAM0_INFO))
SAM0_SERIES := $(word 2, $(SAM0_INFO))
SAM0_PINCNT := $(word 3, $(SAM0_INFO))
SAM0_DENSITY := $(word 4, $(SAM0_INFO))
SAM0_VARIANT := $(word 5, $(SAM0_INFO))

View File

@ -1,3 +1,5 @@
include $(RIOTCPU)/sam0_common/sam0_info.mk
ifneq (,$(filter saml21%a,$(CPU_MODEL)))
CFLAGS += -DCPU_SAML21A
endif
@ -13,9 +15,15 @@ endif
CFLAGS += -DCPU_COMMON_SAML21
ifneq (,$(filter saml21j18b saml21j18a samr30g18a samr34j18b,$(CPU_MODEL)))
BACKUP_RAM_ADDR = 0x30000000
BACKUP_RAM_LEN = 0x2000
BACKUP_RAM_ADDR = 0x30000000
ifeq (18, $(SAM0_DENSITY))
BACKUP_RAM_LEN = 0x2000 # 8k
else ifeq (17, $(SAM0_DENSITY))
BACKUP_RAM_LEN = 0x2000 # 8k
else ifeq (16, $(SAM0_DENSITY))
BACKUP_RAM_LEN = 0x1000 # 4k
else ifeq (15, $(SAM0_DENSITY))
BACKUP_RAM_LEN = 0x800 # 2k
endif
include $(RIOTCPU)/sam0_common/Makefile.include