diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-05-19 12:53:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-19 12:53:23 -0700 |
| commit | 916ca9f8a635d20c299326a955d4ca51dae055e1 (patch) | |
| tree | ea5eebd3cb0e014830bc7bc8784dee0aa09459b9 /supervisor | |
| parent | bdc5a6b7c08ee98541a536c234eedddb006af296 (diff) | |
| parent | acf4b1bedeabe18a7b4b969e7156217ae6bde10a (diff) | |
Merge pull request #2910 from tannewt/esp32s2
Add initial ESP32S2 support
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/port.h | 3 | ||||
| -rwxr-xr-x | supervisor/shared/memory.c | 2 | ||||
| -rwxr-xr-x | supervisor/shared/stack.c | 26 | ||||
| -rwxr-xr-x | supervisor/shared/stack.h | 2 | ||||
| -rw-r--r-- | supervisor/shared/usb/tusb_config.h | 2 | ||||
| -rw-r--r-- | supervisor/shared/usb/usb.c | 2 | ||||
| -rw-r--r-- | supervisor/supervisor.mk | 11 |
7 files changed, 33 insertions, 15 deletions
diff --git a/supervisor/port.h b/supervisor/port.h index ccbb314ad..8a12d34c8 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -29,6 +29,7 @@ #include "py/mpconfig.h" +#include "supervisor/memory.h" #include "supervisor/shared/safe_mode.h" // Provided by the linker; @@ -60,6 +61,8 @@ uint32_t *port_stack_get_limit(void); // Get stack top address uint32_t *port_stack_get_top(void); +supervisor_allocation* port_fixed_stack(void); + // Get heap bottom address uint32_t *port_heap_get_bottom(void); diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index d52334eb4..8ae8a1699 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -129,5 +129,7 @@ supervisor_allocation* allocate_memory(uint32_t length, bool high) { } void supervisor_move_memory(void) { + #if CIRCUITPY_DISPLAYIO supervisor_display_move_memory(); + #endif } diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index 2b7b1c03a..e7aa956b0 100755 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -41,22 +41,24 @@ supervisor_allocation* stack_alloc = NULL; #define EXCEPTION_STACK_SIZE 1024 void allocate_stack(void) { - mp_uint_t regs[10]; - mp_uint_t sp = cpu_get_regs_and_sp(regs); - mp_uint_t c_size = (uint32_t) port_stack_get_top() - sp; + if (port_fixed_stack() != NULL) { + stack_alloc = port_fixed_stack(); + current_stack_size = stack_alloc->length; + } else { + mp_uint_t regs[10]; + mp_uint_t sp = cpu_get_regs_and_sp(regs); - if (port_stack_get_top() != port_heap_get_top()) { - return; + mp_uint_t c_size = (uint32_t) port_stack_get_top() - sp; + stack_alloc = allocate_memory(c_size + next_stack_size + EXCEPTION_STACK_SIZE, true); + if (stack_alloc == NULL) { + stack_alloc = allocate_memory(c_size + CIRCUITPY_DEFAULT_STACK_SIZE + EXCEPTION_STACK_SIZE, true); + current_stack_size = CIRCUITPY_DEFAULT_STACK_SIZE; + } else { + current_stack_size = next_stack_size; + } } - stack_alloc = allocate_memory(c_size + next_stack_size + EXCEPTION_STACK_SIZE, true); - if (stack_alloc == NULL) { - stack_alloc = allocate_memory(c_size + CIRCUITPY_DEFAULT_STACK_SIZE + EXCEPTION_STACK_SIZE, true); - current_stack_size = CIRCUITPY_DEFAULT_STACK_SIZE; - } else { - current_stack_size = next_stack_size; - } *stack_alloc->ptr = STACK_CANARY_VALUE; } diff --git a/supervisor/shared/stack.h b/supervisor/shared/stack.h index 1fb43be57..7096f0b3e 100755 --- a/supervisor/shared/stack.h +++ b/supervisor/shared/stack.h @@ -43,6 +43,8 @@ bool stack_ok(void); // exception when the stack has likely overwritten a portion of the heap. void assert_heap_ok(void); +#ifndef STACK_CANARY_VALUE #define STACK_CANARY_VALUE 0x017829ef +#endif #endif // MICROPY_INCLUDED_SUPERVISOR_STACK_H diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h index 1b0c83416..627de743e 100644 --- a/supervisor/shared/usb/tusb_config.h +++ b/supervisor/shared/usb/tusb_config.h @@ -52,7 +52,9 @@ #define CFG_TUSB_DEBUG 0 /*------------- RTOS -------------*/ +#ifndef CFG_TUSB_OS #define CFG_TUSB_OS OPT_OS_NONE +#endif //#define CFG_TUD_TASK_QUEUE_SZ 16 //#define CFG_TUD_TASK_PRIO 0 //#define CFG_TUD_TASK_STACK_SZ 150 diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 774055a82..edf810118 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -75,7 +75,9 @@ void usb_init(void) { void usb_background(void) { if (usb_enabled()) { + #if CFG_TUSB_OS == OPT_OS_NONE tud_task(); + #endif tud_cdc_write_flush(); } } diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index d6422f074..195e4a9b2 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -3,7 +3,6 @@ SRC_SUPERVISOR = \ supervisor/port.c \ supervisor/shared/autoreload.c \ supervisor/shared/board.c \ - supervisor/shared/display.c \ supervisor/shared/filesystem.c \ supervisor/shared/flash.c \ supervisor/shared/micropython.c \ @@ -104,6 +103,14 @@ else CFLAGS += -DUSB_AVAILABLE endif +SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) + +ifeq ($(CIRCUITPY_DISPLAYIO), 1) + SRC_SUPERVISOR += \ + supervisor/shared/display.c + + SUPERVISOR_O += $(BUILD)/autogen_display_resources.o +endif ifndef USB_INTERFACE_NAME USB_INTERFACE_NAME = "CircuitPython" endif @@ -182,8 +189,6 @@ ifeq ($(USB_RENUMBER_ENDPOINTS), 0) USB_DESCRIPTOR_ARGS += --no-renumber_endpoints endif -SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) $(BUILD)/autogen_display_resources.o - $(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate |
