feat(sptool): populate secure partition number in makefile

Calculate the secure partition number and saves it into the defined
macro NUM_SP.

Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Change-Id: I4175a10d315482b65fd0f3eed4c6fd1e1e2b5e4d
This commit is contained in:
Ben Horgan 2024-10-29 17:54:24 +00:00 committed by Leo Yan
parent bba792b165
commit 93273613b4

View file

@ -30,6 +30,9 @@ Secure Partition entry
FIP_ARGS += --blob uuid=XXXXX-XXX...,file=sp1.pkg
CRT_ARGS += --sp-pkg1 sp1.pkg
It populates the number of SP in the defined macro 'NUM_SP'
$(eval $(call add_define_val,NUM_SP,{len(sp_layout.keys())}))
A typical SP_LAYOUT_FILE file will look like
{
"SP1" : {
@ -151,6 +154,12 @@ def check_max_sps(sp_layout, _, args :dict):
raise Exception(f"Too many SPs in SP layout file. Max: {MAX_SP}")
return args
@SpSetupActions.sp_action(global_action=True)
def count_sps(sp_layout, _, args :dict):
''' Count number of SP and put in NUM_SP '''
write_to_sp_mk_gen(f"$(eval $(call add_define_val,NUM_SP,{len(sp_layout.keys())}))", args)
return args
@SpSetupActions.sp_action
def gen_fdt_sources(sp_layout, sp, args :dict):
''' Generate FDT_SOURCES values for a given SP. '''