Page MenuHomePhabricator

imgtool.py and assemble.py should not only support the hardcode MACRO values
Open, NormalPublic

Description

In ./bl2/ext/mcuboot/scripts/assemble.py:

offset_re = re.compile(r"^#define ([0-9A-Z_]+)_IMAGE_OFFSET\s+((0x)?[0-9a-fA-F]+)")
size_re   = re.compile(r"^#define ([0-9A-Z_]+)_IMAGE_MAX_SIZE\s+((0x)?[0-9a-fA-F]+)")

and in ./bl2/ext/mcuboot/scripts/imgtool.py:

load_address_re = re.compile(r"^#define\sIMAGE_LOAD_ADDRESS\s+(0x[0-9a-fA-F]+)")

It only accept the hardcode value for the MACRO define, if we define it like below:

#define SECURE_IMAGE_MAX_SIZE (0x50000 + 0x100)
#define SECURE_IMAGE_MAX_SIZE S_DATA_SIZE 
#define SECURE_IMAGE_MAX_SIZE (TOTAL_DATA_SIZE-NS_SIZE)

it can not parser the MACRO correct.