commit 82d481172a2e6a2d72c8020cb577c62c25f9b972
parent 5ac4fa7e95e7323f02fb9840222d0b74718b34e3
Author: mehdi-norouzi <mehdeenoroozi@gmail.com>
Date: Mon, 24 Feb 2025 00:22:59 +0330
add README
Diffstat:
4 files changed, 72 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
@@ -0,0 +1,68 @@
+#UART Bootloader for STM32F4 MCU
+This is a simple UART bootloader written for STM32f4 MCUs based on the libopencm3 library.
+
+##Building
+clone this repo:
+```
+git clone git@github.com:mdnr/stm32f4-uart-bootloader.git
+```
+update the submodules (shalow clone). If you don't want to shalow clone the submodules
+you can use `--recursive
+
+##Layout
+Currently memory layout of the MCU is divided as below:
+
+ ```
+ ****************************************
+ 0x0800000: Flash base / Bootloader start
+ Bootloader: 16KB
+ ****************************************
+ 0x0804000: Bootloader end / Parameters start
+ Parameters: 8KB (Config and application settings based on user's needs)
+ ----------------------------------------
+ 0x8002000: Parameters end / Diagnostic area start
+ Doggy litter box: 8KB (Watchdog register dump area)
+ ****************************************
+ 0x0808000: Application start
+ Aplication Vector table
+ ----------------------------------------
+ Firmware info (Version, size, etc)
+ ----------------------------------------
+ Application code
+ ****************************************
+ ```
+ The root directory Makefile takes care of compiling both binaries
+ for bootloader and application and flashing them in the corresponding addresses.
+
+ ```
+ make all -> compile both application and bootloader binaries
+ make app -> compile application binary
+ make bl -> compile bootloader binary
+ make flash -> flash both application and bootloader to MCU
+ make flash-bl -> flash bootloader only without touching the application
+ make flash-app -> flash application only without touching the bootloader
+ ```
+
+ Also there are 2 debug targets `(make fw-debug and make bl-debug)` for debugging the bootlaoder and application
+ remotely on the target.
+
+ ##Using the bootloader
+ Run the python script from the root directory to connect to the serial port using a usb-serial converter
+ ```
+ ./bootloader.py
+ ```
+ Specify the port connected to the MCU board (e.g. `/dev/ttyUSB0`) and choose one of
+ the actions listed:
+ 1. Read parameters -> Read current parameters stored in the MCU's parameter section
+ 2. Update parameters -> Write new parameters to the flash without touching application code
+ 3. Read firmware info -> Read firmware verison, size, etc.
+ 4. Reset the core -> Send reboot command ans start bootloader process.
+ 5. Lock serial line -> Lock the UART line in case it's used by the application
+ 6. UnLock serial line -> Release the UART lock
+ 7. Read diagnostics -> Read the dumped diagnostic data from corresponding section
+ 8. Abort -> Quit the bootlaoder
+
+##TODO
+- Adding GSM layer to support OTA update
+- Rewriting `bootloader.py` in C perhaps and adding proper UI to it
+- Adding Encryption
diff --git a/fwinfo b/fwinfo
@@ -1,9 +0,0 @@
-04, 18, de, c0, ad, de, 54, 04, 00, 00, 00, 05, 01, 67, 32, 39, 62, 36, ff, ff, ff, ff, aa, aa, aa, aa, dd, 6c,
-####################################
-Sentinel: 0xdeadc0de
-Device ID: 1108
-FW Version: v0.5-1-g29b6
-FW Size: 4294967295
-CRC-32: 0xaaaaaaaa
-####################################
-
diff --git a/src/globals/version.h b/src/globals/version.h
@@ -1,6 +1,6 @@
-// fw version: v0.1-3-ge6d1
+// fw version: v0.1-4-g5ac4
#include <stdint.h>
const uint8_t gGIT_VERSION_MAJOR = 0;
const uint8_t gGIT_VERSION_MINOR = 1;
- const uint8_t gGIT_VERSION_PATCH = 3;
- #define gGIT_VERSION_HASH "ge6d1"
+ const uint8_t gGIT_VERSION_PATCH = 4;
+ #define gGIT_VERSION_HASH "g5ac4"
diff --git a/src/shared/mem-blocks.h b/src/shared/mem-blocks.h
@@ -14,7 +14,7 @@
* ******************************************** 0x0804000 Bootloader end / Parameters start
* Parameters: 8KB
* (Config and application settings)
- * ----------------------- 0x8002000
+ * ----------------------- 0x8006000
* Doggy litter box: 8KB
* (Watchdog register dump area)
* ******************************************** 0x0808000 Parameters end / App start