1 #include "aos/hal/flash.h"
2 #include <stddef.h>
3 
4 /* Logic partition on flash devices */
5 const hal_logic_partition_t hal_partitions[] = {
6     [HAL_PARTITION_BOOTLOADER] = {
7             .partition_owner       = HAL_FLASH_EMBEDDED,
8             .partition_description = "boot1",
9             .partition_start_addr  = 0x0,
10             .partition_length      = 0x10000, // 64k bytes
11             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
12         },
13     [HAL_PARTITION_PARAMETER_3] = {
14             .partition_owner       = HAL_FLASH_EMBEDDED,
15             .partition_description = "boot_info",
16             .partition_start_addr  = 0x10000, // boot information need protect
17             .partition_length      = 0x2000,  // 8k bytes
18             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
19         },
20     [HAL_PARTITION_BOOT1] = {
21             .partition_owner       = HAL_FLASH_EMBEDDED,
22             .partition_description = "boot2A",
23             .partition_start_addr  = 0x12000,
24             .partition_length      = 0x18000, // 64k bytes
25             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
26         },
27     [HAL_PARTITION_APPLICATION] = {
28             .partition_owner       = HAL_FLASH_EMBEDDED,
29             .partition_description = "RTOSA",
30             .partition_start_addr  = 0x2A000,
31             .partition_length      = 0x578000, // 5.5M bytes
32             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
33         },
34     [HAL_PARTITION_BOOT1_REDUND] = {
35             .partition_owner       = HAL_FLASH_EMBEDDED,
36             .partition_description = "boot2B",
37             .partition_start_addr  = 0x5A2000,
38             .partition_length      = 0x18000, // 64k bytes
39             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
40         },
41     [HAL_PARTITION_OTA_TEMP] = {
42             .partition_owner       = HAL_FLASH_EMBEDDED,
43             .partition_description = "RTOSB",
44             .partition_start_addr  = 0x5BA000,
45             .partition_length      = 0x578000, // 5.5M bytes
46             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
47         },
48     [HAL_PARTITION_LITTLEFS] = {
49             .partition_owner       = HAL_FLASH_EMBEDDED,
50             .partition_description = "littleFS", // for little fs module
51             .partition_start_addr  = 0xB32000,
52             .partition_length      = 0x4AE000,
53             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
54         },
55     [HAL_PARTITION_PARAMETER_4] = {
56             .partition_owner       = HAL_FLASH_EMBEDDED,
57             .partition_description = "boot1_sec",
58             .partition_start_addr  = 0xFE0000,
59             .partition_length      = 0x10000, // 64k bytes
60             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
61         },
62     [HAL_PARTITION_PARAMETER_1] = {
63             .partition_owner       = HAL_FLASH_EMBEDDED,
64             .partition_description = "boot2_info",
65             .partition_start_addr  = 0xFF0000,
66             .partition_length      = 0x1000, // 4k bytes
67             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
68         },
69     [HAL_PARTITION_PARAMETER_2] = {
70             .partition_owner       = HAL_FLASH_EMBEDDED,
71             .partition_description = "KV", // for KV module
72             .partition_start_addr  = 0xFF1000,
73             .partition_length      = 0xD000, // K bytes
74             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
75         },
76     [HAL_PARTITION_ENV] = {
77             .partition_owner       = HAL_FLASH_EMBEDDED,
78             .partition_description = "factory",
79             .partition_start_addr  = 0xFFE000,
80             .partition_length      = 0x2000,
81             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
82         },
83     [HAL_PARTITION_ENV_REDUND] = {
84             .partition_owner       = HAL_FLASH_EMBEDDED,
85             .partition_description = "factory_backup",
86             .partition_start_addr  = 0xFFE000,
87             .partition_length      = 0x2000,
88             .partition_options     = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
89         },
90 };
91 
92 /*  Declare a constant to indicate the defined partitions amount */
93 const size_t hal_partitions_amount =
94     (sizeof(hal_partitions) / sizeof(hal_logic_partition_t));
95