summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binmaker.py40
-rwxr-xr-xsw/Core/Src/plinky.c2
-rwxr-xr-xsw/Core/Src/sysmem.c2
3 files changed, 42 insertions, 2 deletions
diff --git a/binmaker.py b/binmaker.py
new file mode 100644
index 0000000..57bbb6a
--- /dev/null
+++ b/binmaker.py
@@ -0,0 +1,40 @@
+def main():
+ # bin file maker
+ ver1 = '0'
+ ver2 = '0'
+ ver3 = '0'
+ try:
+ with open("sw/Release/plinkybl.bin", "rb") as f1:
+ bl_content = f1.read()
+ with open("sw/Release/plinkyblack.bin", "rb") as f2:
+ app_content = f2.read()
+ except IOError as e:
+ print(f"Failed to open file: {e}")
+ exit(2)
+ appsize = len(app_content)
+ print(f'{appsize} app, {len(bl_content)} bootloader')
+ # pad bl_content and app_content to reach their sizes
+ bl_content += b'\xff' * (65536 - len(bl_content))
+ app_content += b'\xff' * (1024 * 1024 - 65536 - len(app_content))
+
+ app = bl_content + app_content
+
+ if app[appsize + 65536 - 6]==b'v' and app[appsize + 65536 - 4] == b'.':
+ ver1 = chr(app[appsize + 65536 - 5])
+ ver2 = chr(app[appsize + 65536 - 3])
+ ver3 = chr(app[appsize + 65536 - 2])
+ else:
+ print("!!!!!!!!!!!!!!!! NO VERSION FOUND IN BIN FILE")
+ exit(2)
+ print(f"bootloader size {len(bl_content)}, app size {appsize}, version {ver1}{ver2}{ver3}")
+ fname = f"plink{ver1}{ver2}{ver3}.bin"
+ try:
+ with open(fname, "wb") as fo:
+ fo.write(app)
+ except IOError as e:
+ print(f"Failed to write file: {e}")
+ exit(2)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sw/Core/Src/plinky.c b/sw/Core/Src/plinky.c
index 5427162..49cb95f 100755
--- a/sw/Core/Src/plinky.c
+++ b/sw/Core/Src/plinky.c
@@ -2908,7 +2908,7 @@ void HAL_UART_ErrorCallback(UART_HandleTypeDef* huart) {
HAL_UART_Receive_DMA(&huart3, uartbuf, sizeof(uartbuf));
}
-
+typedef unsigned int uint;
u8 midisendbuf[16+16];
uint midisendhead,midisendtail;
bool usb_midi_write(const uint8_t packet[4]);
diff --git a/sw/Core/Src/sysmem.c b/sw/Core/Src/sysmem.c
index 4665417..d97ae4b 100755
--- a/sw/Core/Src/sysmem.c
+++ b/sw/Core/Src/sysmem.c
@@ -24,7 +24,7 @@
/* Includes */
#include <errno.h>
#include <stdio.h>
-
+#include <sys/types.h>
/* Variables */
extern int errno;
register char * stack_ptr asm("sp");