aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stm32/main.c12
-rw-r--r--stm32/makefile3
-rw-r--r--test/bin/stm32-rom-poc.bs2
3 files changed, 15 insertions, 2 deletions
diff --git a/stm32/main.c b/stm32/main.c
index 14b2a41..fa0ef66 100644
--- a/stm32/main.c
+++ b/stm32/main.c
@@ -1,5 +1,6 @@
#include <stm32f0xx_hal.h>
#include <stm32f0xx_hal_uart.h>
+#include <stm32f0xx.h>
void error_handler() {
__disable_irq();
@@ -38,6 +39,8 @@ void HAL_UART_MspInit(UART_HandleTypeDef *huart) {
});
}
+const uint32_t* BIG_DATA_PTR = (uint32_t*) 0x0803F800;
+
void setup() {
if (HAL_UART_Init(&huart2) != HAL_OK)
return error_handler();
@@ -46,8 +49,13 @@ void setup() {
int main() {
setup();
- const char test_data[] = "hello world!\r\n";
- HAL_UART_Transmit(&huart2, (uint8_t*) test_data, sizeof(test_data), 100);
+ HAL_UART_Transmit(&huart2, (uint8_t*) "[", 1, 100);
+ for (unsigned int i = 0; i < 4; i++) {
+ uint32_t word = BIG_DATA_PTR[i];
+ uint8_t* bytes = (uint8_t*) &word;
+ HAL_UART_Transmit(&huart2, bytes, 4, 100);
+ }
+ HAL_UART_Transmit(&huart2, (uint8_t*) "]", 1, 100);
while(1);
}
diff --git a/stm32/makefile b/stm32/makefile
index 22e956e..60cbc15 100644
--- a/stm32/makefile
+++ b/stm32/makefile
@@ -96,6 +96,9 @@ $(TARGET).elf: $(OBJS)
flash: $(TARGET).bin
st-flash --reset write $(TARGET).bin 0x08000000
+rom:
+ st-flash write ../test/bin/stm32-rom-poc.bin 0x0803F800
+
compile_commands.json: clean
compiledb make -Bn
../scripts/compiledb-full-path-mingw.sh compile_commands.json
diff --git a/test/bin/stm32-rom-poc.bs b/test/bin/stm32-rom-poc.bs
new file mode 100644
index 0000000..cdd97f5
--- /dev/null
+++ b/test/bin/stm32-rom-poc.bs
@@ -0,0 +1,2 @@
+68 65 6c 6c 6f 20 77 6f 72 6c 64 0d 0a ; hello world\r\n
+