1 /*
2  * Copyright (C) 2015-2017 Alibaba Group Holding Limited
3  */
4 
5 #include <aos/mtdpart.h>
6 #include <aos/mtd.h>
7 
8 /* Logic partition on flash devices */
9 const mtd_partition_t mtd_partitions[] =
10 {
11     {
12         .partition_name             = "BOOTLOADER",
13         .partition_name_std         = MTD_PART_NAME_BOOTLOADER,
14         .partition_start_addr       = 0x4000,
15         .partition_length           = 0x2000,    /* 64KB */
16         .partition_options          = 0,
17     },
18     {
19         .partition_name             = "PARAMETE1",
20         .partition_name_std         = MTD_PART_NAME_ENV,
21         .partition_start_addr       = 0x3FF000,
22         .partition_length           = 0x1000, /* boot env, 4KB */
23         .partition_options          = 0,
24     },
25     {
26         .partition_name             = "PARAMETER2",
27         .partition_name_std         = MTD_PART_NAME_KV,
28         .partition_start_addr       = 0x3FD000,
29         .partition_length           = 0x2000, /* kv, 8KB */
30         .partition_options          = 0,
31     },
32     {
33         .partition_name             = "PARAMETER3",
34         .partition_name_std         = MTD_PART_NAME_BOOTLOADER_SEC,
35         .partition_start_addr       = 0x3FC000,
36         .partition_length           = 0x1000, /* security,factory, 4KB */
37         .partition_options          = 0,
38     },
39     {
40         .partition_name             = "PARAMETER4",
41         .partition_name_std         = MTD_PART_NAME_UNKNOWN,
42         .partition_start_addr       = 0x3FB000,
43         .partition_length           = 0x1000, /* reserved, 4KB*/
44         .partition_options          = 0,
45     },
46     {
47         .partition_name             = "APPLICATION",
48         .partition_name_std         = MTD_PART_NAME_KERNEL,
49         .partition_start_addr       = 0x14000,
50         .partition_length           = 0x200000, /* OTA A system, 2MB */
51         .partition_options          = 0,
52     },
53     {
54         .partition_name            = "APPLICATION_B",
55         .partition_name_std         = MTD_PART_NAME_KERNEL2,
56         .partition_start_addr      = 0x214000,
57         .partition_length          = 0x140000, /* OTA B system, 1.25MB */
58         .partition_options         = 0,
59     },
60     {
61         .partition_name            = "LITTLEFS",
62         .partition_name_std         = MTD_PART_NAME_LITTLEFS,
63         .partition_start_addr      = 0x354000,
64         .partition_length          = 0xa7000, /* littlefs, 668KB*/
65         .partition_options         = 0,
66     },
67     {
68         .partition_name            = "2NDBOOT",
69         .partition_name_std         = MTD_PART_NAME_2ND_BOOTLOADER,
70         .partition_start_addr      = 0x6000,
71         .partition_length          = 0xe000, /* 2nd bootloader, 56KB*/
72         .partition_options         = 0,
73     }
74 
75 };
76 
77 /* Declare a constant to indicate the defined partitions amount */
78 const int mtd_partitions_amount = (sizeof(mtd_partitions) / sizeof(mtd_partition_t));
79