8000 samd/mpconfigport: Restructure to use ROM feature levels. · jimmo/micropython@929dfc6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 929dfc6

Browse files
robert-hhdpgeorge
authored andcommitted
samd/mpconfigport: Restructure to use ROM feature levels.
Changes are: - Set the feature level for each MCU: CORE features for SAMD21, and EXTRA features for SAMD51. - Remove all definitions that are included in the core feature level. - Keep the default settings for feature level and float, to make the choice obvious.
1 parent a415752 commit 929dfc6

File tree

4 files changed

+33
-38
lines changed

4 files changed

+33
-38
lines changed

ports/samd/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ SRC_QSTR += \
161161
shared/readline/readline.c \
162162
extmod/uos_dupterm.c \
163163
shared/runtime/mpirq.c \
164+
shared/runtime/sys_stdio_mphal.c \
164165

165166
SRC_QSTR += $(SRC_MOD) $(SRC_CXX)
166167

ports/samd/mcu/samd21/mpconfigmcu.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
// Deinitions common to all SAMD21 boards
22
#include "samd21.h"
33

4-
#define MICROPY_HW_FLASH_STORAGE_BASE (0x30000)
5-
#define MICROPY_HW_FLASH_STORAGE_BYTES (0xFFFF)
6-
#define VFS_BLOCK_SIZE_BYTES (1536) // 24x 64B flash pages;
4+
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES)
75

8-
#define MICROPY_HW_UART_TXBUF (1)
6+
// MicroPython emitters
7+
#define MICROPY_EMIT_THUMB (0)
8+
#define MICROPY_EMIT_INLINE_THUMB (0)
99

10-
#define CPU_FREQ (48000000)
11-
#define APB_FREQ (48000000)
10+
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
1211

13-
#define IRQ_PRI_PENDSV ((1 << __NVIC_PRIO_BITS) - 1)
12+
#define MICROPY_HW_FLASH_S 10000 TORAGE_BASE (0x30000)
13+
#define MICROPY_HW_FLASH_STORAGE_BYTES (0xFFFF)
14+
#define VFS_BLOCK_SIZE_BYTES (1536) // 24x 64B flash pages;
15+
16+
#define MICROPY_HW_UART_TXBUF (1)
17+
18+
#define CPU_FREQ (48000000)
19+
#define APB_FREQ (48000000)
20+
21+
#define IRQ_PRI_PENDSV ((1 << __NVIC_PRIO_BITS) - 1)
1422

1523
static inline uint32_t raise_irq_pri(uint32_t pri) {
1624
(void)pri;

ports/samd/mcu/samd51/mpconfigmcu.h

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
// Deinitions common to all SAMD51 boards
22
#include "samd51.h"
33

4+
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_FULL_FEATURES)
5+
6+
// MicroPython emitters
7+
#define MICROPY_EMIT_THUMB (1)
8+
#define MICROPY_EMIT_INLINE_THUMB (1)
9+
410
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
511
#define MICROPY_PY_BUILTINS_COMPLEX (0)
612
#define MICROPY_PY_MATH (0)
713
#define MICROPY_PY_CMATH (0)
14+
815
#define MICROPY_PY_UOS_URANDOM (1)
916
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (trng_random_u32())
1017
unsigned long trng_random_u32(void);
@@ -15,18 +22,18 @@ unsigned long trng_random_u32(void);
1522
// samd_flash.c flash parameters
1623
// Build a 128k Flash storage at top. 512k-128k=384k=0x60000
1724
// 512*1024= 0x80000 minus 128*1024= 0x20000 = 0x60000
18-
#define MICROPY_HW_FLASH_STORAGE_BASE (0x60000)
19-
#define MICROPY_HW_FLASH_STORAGE_BYTES (0x1FFFF)
20-
#define VFS_BLOCK_SIZE_BYTES (1536) //
25+
#define MICROPY_HW_FLASH_STORAGE_BASE (0x60000)
26+
#define MICROPY_HW_FLASH_STORAGE_BYTES (0x1FFFF)
27+
#define VFS_BLOCK_SIZE_BYTES (1536) //
2128

22-
#define MICROPY_HW_UART_TXBUF (1)
29+
#define MICROPY_HW_UART_TXBUF (1)
2330

24-
#define CPU_FREQ (120000000)
25-
#define APB_FREQ (48000000)
26-
#define DPLLx_REF_FREQ (32768)
31+
#define CPU_FREQ (120000000)
32+
#define APB_FREQ (48000000)
33+
#define DPLLx_REF_FREQ (32768)
2734

28-
#define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003)
29-
#define IRQ_PRI_PENDSV NVIC_EncodePriority(NVIC_PRIORITYGROUP_4, 7, 0)
35+
#define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003)
36+
#define IRQ_PRI_PENDSV NVIC_EncodePriority(NVIC_PRIORITYGROUP_4, 7, 0)
3037

3138
static inline uint32_t raise_irq_pri(uint32_t pri) {
3239
uint32_t basepri = __get_BASEPRI();

ports/samd/mpconfigport.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040

4141
// MicroPython emitters
4242
#define MICROPY_PERSISTENT_CODE_LOAD (1)
43-
#define MICROPY_EMIT_THUMB (0)
44-
#define MICROPY_EMIT_INLINE_THUMB (0)
4543

4644
// Compiler configuration
4745
#define MICROPY_COMP_CONST (1)
@@ -56,33 +54,18 @@
5654
#define MICROPY_ENABLE_SOURCE_LINE (1)
5755
#define MICROPY_STREAMS_NON_BLOCK (1)
5856
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
59-
#define MICROPY_CPYTHON_COMPAT (0)
60-
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
6157
#define MICROPY_PY_BUILTINS_HELP (1)
6258
#define MICROPY_PY_BUILTINS_HELP_TEXT samd_help_text
6359
#define MICROPY_PY_BUILTINS_HELP_MODULES (1)
6460
#define MICROPY_ENABLE_SCHEDULER (1)
65-
// fixes sys/usys import issue
6661
#define MICROPY_MODULE_WEAK_LINKS (1)
62+
6763
// Control over Python builtins
68-
#define MICROPY_PY_ASYNC_AWAIT (0)
6964
#define MICROPY_PY_BUILTINS_BYTES_HEX (1)
70-
#define MICROPY_PY_BUILTINS_STR_COUNT (0)
7165
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
72-
#define MICROPY_PY_BUILTINS_SET (0)
73-
#define MICROPY_PY_BUILTINS_FROZENSET (0)
74-
#define MICROPY_PY_BUILTINS_PROPERTY (0)
75-
#define MICROPY_PY_BUILTINS_ENUMERATE (1)
76-
#define MICROPY_PY_BUILTINS_FILTER (0)
77-
#define MICROPY_PY_BUILTINS_REVERSED (0)
78-
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
79-
#define MICROPY_PY_BUILTINS_MIN_MAX (1)
8066
#define MICROPY_PY_BUILTINS_INPUT (1)
81-
#define MICROPY_PY___FILE__ (0)
8267
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
8368
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
84-
#define MICROPY_PY_ATTRTUPLE (1)
85-
#define MICROPY_PY_COLLECTIONS (0)
8669
#define MICROPY_PY_SYS (1)
8770
#define MICROPY_PY_SYS_PLATFORM "samd"
8871
#define MICROPY_PY_SYS_EXIT (1)
@@ -118,10 +101,6 @@
118101
#define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1)
119102
#define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/samd/machine_pwm.c"
120103

121-
// Use VfsLfs's types for fileio/textio
122-
#define mp_type_fileio mp_type_vfs_lfs1_fileio
123-
#define mp_type_textio mp_type_vfs_lfs1_textio
124-
125104
#define MP_STATE_PORT MP_STATE_VM
126105

127106
// Miscellaneous settings

0 commit comments

Comments
 (0)
0