[core] Provide entire flash as "root" partition
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
|
||||
using namespace arduino;
|
||||
|
||||
extern "C" {
|
||||
#include <fal.h>
|
||||
fal_partition_t fal_root_part = NULL;
|
||||
}
|
||||
|
||||
// Weak empty variant initialization function.
|
||||
// May be redefined by variant files.
|
||||
void initVariant() __attribute__((weak));
|
||||
@@ -32,6 +37,10 @@ int main(void) {
|
||||
__libc_init_array();
|
||||
// optionally initialize per-variant code
|
||||
initVariant();
|
||||
// initialize FAL
|
||||
fal_init();
|
||||
// provide root partition
|
||||
fal_root_part = (fal_partition_t)fal_partition_find("root");
|
||||
// start the main task and OS kernel
|
||||
startMainTask();
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fal_def.h>
|
||||
|
||||
// Flash device configuration
|
||||
extern const struct fal_flash_dev flash0;
|
||||
|
||||
@@ -23,3 +25,8 @@ extern const struct fal_flash_dev flash0;
|
||||
.offset = FLASH_##part_upper##_OFFSET, /* partition offset macro as uppercase string */ \
|
||||
.len = FLASH_##part_upper##_LENGTH, /* partition length macro as uppercase string */ \
|
||||
},
|
||||
|
||||
/**
|
||||
* @brief Root partition table, representing the entire flash.
|
||||
*/
|
||||
extern fal_partition_t fal_root_part;
|
||||
|
||||
@@ -11,6 +11,9 @@ def env_add_flash_layout(env, board):
|
||||
defines = {}
|
||||
flash_size = 0
|
||||
fal_items = ""
|
||||
# add "root" partition
|
||||
fal_items += "FAL_PART_TABLE_ITEM(root, ROOT)"
|
||||
# add all partitions
|
||||
for name, layout in flash_layout.items():
|
||||
name = name.upper()
|
||||
(offset, _, length) = layout.partition("+")
|
||||
@@ -19,6 +22,10 @@ def env_add_flash_layout(env, board):
|
||||
fal_items += f"FAL_PART_TABLE_ITEM({name.lower()}, {name})"
|
||||
flash_size = max(flash_size, int(offset, 16) + int(length, 16))
|
||||
defines["FLASH_LENGTH"] = flash_size
|
||||
# for "root" partition
|
||||
defines["FLASH_ROOT_OFFSET"] = 0
|
||||
defines["FLASH_ROOT_LENGTH"] = flash_size
|
||||
# add partition table array
|
||||
defines["FAL_PART_TABLE"] = "{" + fal_items + "}"
|
||||
env.Append(CPPDEFINES=list(defines.items()))
|
||||
env.Replace(**defines)
|
||||
|
||||
Reference in New Issue
Block a user