|
32 | 32 |
|
33 | 33 | #ifdef SAMD21 |
34 | 34 |
|
35 | | -// Default is 0, set by py/circuitpy_mpconfig.h |
36 | 35 | #if INTERNAL_FLASH_FILESYSTEM |
37 | | -// 64kB |
38 | | -#define INTERNAL_FLASH_FILESYSTEM_SIZE (64*1024) |
| 36 | +#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (64*1024) |
| 37 | +#else |
| 38 | +#define CIRCUITPYINTERNAL_FLASH_FILESYSTEM_SIZE (0) |
39 | 39 | #endif |
40 | 40 |
|
41 | 41 | #ifndef CIRCUITPY_INTERNAL_NVM_SIZE |
|
86 | 86 | #define CIRCUITPY_INTERNAL_NVM_SIZE (8192) |
87 | 87 | #endif |
88 | 88 |
|
| 89 | +// If CIRCUITPY is internal, use half of flash for it. |
| 90 | +#ifndef CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE |
| 91 | + #if INTERNAL_FLASH_FILESYSTEM |
| 92 | + #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (FLASH_SIZE/2) |
| 93 | + #else |
| 94 | + #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (0) |
| 95 | + #endif |
| 96 | +#endif |
| 97 | + |
89 | 98 | // HSRAM_SIZE is defined in the ASF4 include files for each SAMD51 chip. |
90 | 99 | #define RAM_SIZE HSRAM_SIZE |
91 | 100 | #define BOOTLOADER_SIZE (16*1024) |
|
104 | 113 |
|
105 | 114 | #endif // SAMD51 |
106 | 115 |
|
| 116 | +// Flash layout, starting at 0x00000000 |
| 117 | +// |
| 118 | +// bootloader (8 or 16kB) |
| 119 | +// firmware |
| 120 | +// internal config, used to store crystalless clock calibration info (optional) |
| 121 | +// microntroller.nvm (optional) |
| 122 | +// internal CIRCUITPY flash filesystem (optional) |
| 123 | + |
| 124 | +// Bootloader starts at 0x00000000. |
| 125 | +#define CIRCUITPY_FIRMWARE_START_ADDR BOOTLOADER_SIZE |
| 126 | + |
| 127 | +// Total space available for code, after subtracting size of other regions used for non-code. |
| 128 | +#define CIRCUITPY_FIRMWARE_SIZE \ |
| 129 | + (FLASH_SIZE - BOOTLOADER_SIZE - CIRCUITPY_INTERNAL_CONFIG_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE - \ |
| 130 | + CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE) |
| 131 | + |
| 132 | +#define CIRCUITPY_INTERNAL_CONFIG_START_ADDR (CIRCUITPY_FIRMWARE_START_ADDR + CIRCUITPY_FIRMWARE_SIZE) |
| 133 | +#define CIRCUITPY_INTERNAL_NVM_START_ADDR (CIRCUITPY_INTERNAL_CONFIG_START_ADDR + CIRCUITPY_INTERNAL_CONFIG_SIZE) |
| 134 | +#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR \ |
| 135 | + (CIRCUITPY_INTERNAL_NVM_START_ADDR + CIRCUITPY_INTERNAL_NVM_SIZE) |
| 136 | + |
107 | 137 | // Turning off audioio, audiobusio, and touchio as necessary |
108 | 138 | // due to limitations of chips is handled in mpconfigboard.mk |
109 | 139 |
|
|
0 commit comments