summaryrefslogtreecommitdiff
path: root/supervisor/shared
diff options
context:
space:
mode:
Diffstat (limited to 'supervisor/shared')
-rw-r--r--supervisor/shared/bluetooth.c1
-rwxr-xr-xsupervisor/shared/memory.c2
-rwxr-xr-xsupervisor/shared/stack.c26
-rwxr-xr-xsupervisor/shared/stack.h2
-rw-r--r--supervisor/shared/usb/tusb_config.h2
-rw-r--r--supervisor/shared/usb/usb.c2
6 files changed, 23 insertions, 12 deletions
diff --git a/supervisor/shared/bluetooth.c b/supervisor/shared/bluetooth.c
index b463160cf..98d0fab38 100644
--- a/supervisor/shared/bluetooth.c
+++ b/supervisor/shared/bluetooth.c
@@ -74,6 +74,7 @@ void supervisor_bluetooth_start_advertising(void) {
// TODO: switch to Adafruit short UUID for the advertisement and add manufacturing data to distinguish ourselves from arduino.
_common_hal_bleio_adapter_start_advertising(&common_hal_bleio_adapter_obj,
true,
+ false, 0,
1.0,
circuitpython_advertising_data,
sizeof(circuitpython_advertising_data),
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();
}
}