From 52d44b894255d691bcb42626a1bdcc7b65c5cf03 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Sat, 19 Dec 2020 17:59:33 +0100
Subject: [PATCH] change(epicardium): Increase size to 576 kb

Pycardium gets a bit smaller now: 384 kb
---
 bootloader/build_multi_image.sh                               | 4 ++--
 epicardium/modules/lifecycle.c                                | 2 +-
 .../CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core0.ld  | 2 +-
 .../CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core1.ld  | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bootloader/build_multi_image.sh b/bootloader/build_multi_image.sh
index c4b799a4c..f8ee285fd 100755
--- a/bootloader/build_multi_image.sh
+++ b/bootloader/build_multi_image.sh
@@ -6,12 +6,12 @@ BIN1="$2"
 BIN2="$3"
 BINOUT="$4"
 
-if [ "$(stat -c "%s" "${BIN1}")" -gt 458752 ]; then
+if [ "$(stat -c "%s" "${BIN1}")" -gt 589824 ]; then
     echo "$0: ${BIN1} is too big to fit!" >&2
     exit 1
 fi
 
-objcopy -I binary -O binary --pad-to=458752 --gap-fill=255 "${BIN1}" "$BINOUT"
+objcopy -I binary -O binary --pad-to=589824 --gap-fill=255 "${BIN1}" "$BINOUT"
 cat "$BIN2" >>"$BINOUT"
 
 "$PYTHON" "$(dirname "$0")/crc_patch.py" "$BINOUT"
diff --git a/epicardium/modules/lifecycle.c b/epicardium/modules/lifecycle.c
index 76c5648cc..f4d820623 100644
--- a/epicardium/modules/lifecycle.c
+++ b/epicardium/modules/lifecycle.c
@@ -15,7 +15,7 @@
 #include <stdbool.h>
 #include <stdbool.h>
 
-#define PYCARDIUM_IVT (void *)0x10080000
+#define PYCARDIUM_IVT (void *)0x100a0000
 #define BLOCK_WAIT pdMS_TO_TICKS(1000)
 /*
  * Loading an empty filename into Pycardium will drop straight into the
diff --git a/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core0.ld b/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core0.ld
index 2c2e94e19..04bacddfa 100644
--- a/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core0.ld
+++ b/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core0.ld
@@ -40,7 +40,7 @@ STACK_SIZE = 0x1000;
 /* If used, they should be adjusted for the external Flash/RAM size */
 MEMORY {
     SPIX (rx)  : ORIGIN = 0x08000000, LENGTH = 128M
-    FLASH (rx) : ORIGIN = 0x10010000, LENGTH = 448k
+    FLASH (rx) : ORIGIN = 0x10010000, LENGTH = 576k
     SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
     SPID (r)   : ORIGIN = 0x80000000, LENGTH = 512M
 }
diff --git a/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core1.ld b/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core1.ld
index 2dedc3ddf..19f2d6196 100644
--- a/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core1.ld
+++ b/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665_core1.ld
@@ -40,7 +40,7 @@ STACK_SIZE = 0x2000;
 /* If used, they should be adjusted for the external Flash/RAM size */
 MEMORY {
     SPIX (rx)  : ORIGIN = 0x08000000, LENGTH = 128M
-    FLASH (rx) : ORIGIN = 0x10080000, LENGTH = 512k
+    FLASH (rx) : ORIGIN = 0x100a0000, LENGTH = 384k
     SRAM (rwx) : ORIGIN = 0x20040000, LENGTH = 256k
     SPID (r)   : ORIGIN = 0x80000000, LENGTH = 512M
 }
-- 
GitLab