浏览代码

fw/flash_region: allow defining custom base address

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Gerard Marull-Paretas 2 月之前
父节点
当前提交
d2251ca818
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/fw/flash_region/flash_region_def_helper.h

+ 6 - 2
src/fw/flash_region/flash_region_def_helper.h

@@ -23,12 +23,16 @@ enum {
 #define FLASH_REGION_ADDR_HELPER(name, size, tgt) \
     + (FlashRegion_##name < (tgt) ? (size) : 0)
 
+#ifndef FLASH_REGION_BASE_ADDRESS
+#define FLASH_REGION_BASE_ADDRESS 0
+#endif
+
 // These macros add up all the sizes of the flash regions that come before (and including in the
 // case of the _END_ADDR macro) the specified one to determine the proper flash address value.
 #define FLASH_REGION_START_ADDR(region) \
-  ((0) FLASH_REGION_DEF(FLASH_REGION_ADDR_HELPER, FlashRegion_##region))
+  (((0) FLASH_REGION_DEF(FLASH_REGION_ADDR_HELPER, FlashRegion_##region)) + FLASH_REGION_BASE_ADDRESS)
 #define FLASH_REGION_END_ADDR(region) \
-  ((0) FLASH_REGION_DEF(FLASH_REGION_ADDR_HELPER, FlashRegion_##region + 1))
+  (((0) FLASH_REGION_DEF(FLASH_REGION_ADDR_HELPER, FlashRegion_##region + 1)) + FLASH_REGION_BASE_ADDRESS)
 
 // Checks that all regions are a multiple of the specified size (usually sector or subsector size)
 #define FLASH_REGION_SIZE_CHECK_HELPER(name, size, arg) \