aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-03-01 11:37:32 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-03-01 19:05:00 -0500
commit0b33e0b427641f22b47afb230dc8f623d743971c (patch)
tree70f63ddebb52566466120f069da4cab36f31169b
parenta1d74a08e4f671edfc5b5ad575c3f97077e37154 (diff)
downloadkutter-0b33e0b427641f22b47afb230dc8f623d743971c.tar.gz
kutter-0b33e0b427641f22b47afb230dc8f623d743971c.tar.xz
kutter-0b33e0b427641f22b47afb230dc8f623d743971c.zip
atsamd: Implement custom memory allocation functions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/atsamd/Makefile3
-rw-r--r--src/atsamd/main.c16
2 files changed, 17 insertions, 2 deletions
diff --git a/src/atsamd/Makefile b/src/atsamd/Makefile
index 5b279903..6db2e177 100644
--- a/src/atsamd/Makefile
+++ b/src/atsamd/Makefile
@@ -17,8 +17,7 @@ CFLAGS += $(CFLAGS-y) -D__$(MCU)__ -mthumb -Ilib/cmsis-core
CFLAGS_klipper.elf += -T $(OUT)samd.ld --specs=nano.specs --specs=nosys.specs
# Add source files
-src-y += atsamd/main.c atsamd/gpio.c
-src-y += generic/crc16_ccitt.c generic/alloc.c generic/armcm_irq.c
+src-y += atsamd/main.c atsamd/gpio.c generic/crc16_ccitt.c generic/armcm_irq.c
src-$(CONFIG_USBSERIAL) += atsamd/usbserial.c generic/usb_cdc.c
src-$(CONFIG_SERIAL) += atsamd/serial.c generic/serial_irq.c
src-$(CONFIG_HAVE_GPIO_ADC) += atsamd/adc.c
diff --git a/src/atsamd/main.c b/src/atsamd/main.c
index 9233662f..5a5a374d 100644
--- a/src/atsamd/main.c
+++ b/src/atsamd/main.c
@@ -10,6 +10,22 @@
DECL_CONSTANT(MCU, CONFIG_MCU);
+// Return the start of memory available for dynamic allocations
+void *
+dynmem_start(void)
+{
+ extern uint32_t _ezero;
+ return &_ezero;
+}
+
+// Return the end of memory available for dynamic allocations
+void *
+dynmem_end(void)
+{
+ extern uint32_t _sstack;
+ return &_sstack;
+}
+
void
command_reset(uint32_t *args)
{