diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/RTE/_Test/Pre_Include_Global.h b/examples/stm32/nucleo-f746zg-keil-baremetal/RTE/_Test/Pre_Include_Global.h
new file mode 100644
index 00000000..3e5a8bb8
--- /dev/null
+++ b/examples/stm32/nucleo-f746zg-keil-baremetal/RTE/_Test/Pre_Include_Global.h
@@ -0,0 +1,17 @@
+
+/*
+ * Auto generated Run-Time-Environment Configuration File
+ * *** Do not modify ! ***
+ *
+ * Project: 'device-dashboard'
+ * Target: 'Test'
+ */
+
+#ifndef PRE_INCLUDE_GLOBAL_H
+#define PRE_INCLUDE_GLOBAL_H
+
+/* Keil::Device:STM32Cube HAL:Common:1.3.0 */
+#define USE_HAL_DRIVER
+
+
+#endif /* PRE_INCLUDE_GLOBAL_H */
diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/RTE/_Test/RTE_Components.h b/examples/stm32/nucleo-f746zg-keil-baremetal/RTE/_Test/RTE_Components.h
new file mode 100644
index 00000000..ced1c3cb
--- /dev/null
+++ b/examples/stm32/nucleo-f746zg-keil-baremetal/RTE/_Test/RTE_Components.h
@@ -0,0 +1,46 @@
+
+/*
+ * Auto generated Run-Time-Environment Configuration File
+ * *** Do not modify ! ***
+ *
+ * Project: 'device-dashboard'
+ * Target: 'Test'
+ */
+
+#ifndef RTE_COMPONENTS_H
+#define RTE_COMPONENTS_H
+
+
+/*
+ * Define the Device Header File:
+ */
+#define CMSIS_device_header "stm32f7xx.h"
+
+/* Keil.ARM Compiler::Compiler:I/O:STDOUT:User:1.2.0 */
+#define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */
+ #define RTE_Compiler_IO_STDOUT_User /* Compiler I/O: STDOUT User */
+/* Keil::Device:STM32Cube Framework:STM32CubeMX:1.1.0 */
+#define RTE_DEVICE_FRAMEWORK_CUBE_MX
+/* Keil::Device:STM32Cube HAL:Common:1.3.0 */
+#define RTE_DEVICE_HAL_COMMON
+/* Keil::Device:STM32Cube HAL:Cortex:1.3.0 */
+#define RTE_DEVICE_HAL_CORTEX
+/* Keil::Device:STM32Cube HAL:DMA:1.3.0 */
+#define RTE_DEVICE_HAL_DMA
+/* Keil::Device:STM32Cube HAL:ETH:1.3.0 */
+#define RTE_DEVICE_HAL_ETH
+/* Keil::Device:STM32Cube HAL:GPIO:1.3.0 */
+#define RTE_DEVICE_HAL_GPIO
+/* Keil::Device:STM32Cube HAL:PWR:1.3.0 */
+#define RTE_DEVICE_HAL_PWR
+/* Keil::Device:STM32Cube HAL:RCC:1.3.0 */
+#define RTE_DEVICE_HAL_RCC
+/* Keil::Device:STM32Cube HAL:RNG:1.3.0 */
+#define RTE_DEVICE_HAL_RNG
+/* Keil::Device:STM32Cube HAL:UART:1.3.0 */
+#define RTE_DEVICE_HAL_UART
+/* Keil::Device:Startup:1.2.5 */
+#define RTE_DEVICE_STARTUP_STM32F7XX /* Device Startup for STM32F7 */
+
+
+#endif /* RTE_COMPONENTS_H */
diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvoptx b/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvoptx
index 04efcb0b..73e75ffd 100644
--- a/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvoptx
+++ b/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvoptx
@@ -201,6 +201,186 @@
+
+ Test
+ 0x4
+ ARM-ADS
+
+ 16000000
+
+ 1
+ 1
+ 0
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\Listings\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 1
+ 0
+ 0
+
+ 18
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+ STLink\ST-LINKIII-KEIL_SWO.dll
+
+
+
+ 0
+ ARMRTXEVENTFLAGS
+ -L70 -Z18 -C0 -M0 -T1
+
+
+ 0
+ DLGTARM
+ (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)
+
+
+ 0
+ ARMDBGFLAGS
+
+
+
+ 0
+ ST-LINKIII-KEIL_SWO
+ -U-O206 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(5BA02477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20010000 -FC1000 -FN2 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F746ZGTx$CMSIS\Flash\STM32F7x_1024.FLM) -FF1STM32F7xTCM_1024.FLM -FS1200000 -FL1100000 -FP1($$Device:STM32F746ZGTx$CMSIS\Flash\STM32F7xTCM_1024.FLM)
+
+
+ 0
+ DLGUARM
+ (105=-1,-1,-1,-1,0)
+
+
+ 0
+ UL2CM3
+ UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN2 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FF1STM32F7xTCM_1024 -FS1200000 -FL1100000 -FP0($$Device:STM32F746ZGTx$CMSIS\Flash\STM32F7x_1024.FLM) -FP1($$Device:STM32F746ZGTx$CMSIS\Flash\STM32F7xTCM_1024.FLM))
+
+
+
+
+ 0
+
+
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 2
+ 10000000
+
+
+
+
Source Group 1
1
diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvprojx b/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvprojx
index d5f0458c..95275827 100644
--- a/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvprojx
+++ b/examples/stm32/nucleo-f746zg-keil-baremetal/device-dashboard.uvprojx
@@ -49,10 +49,10 @@
1
.\Objects\
- firmware
+ device-dashboard
1
0
- 1
+ 0
1
1
.\Listings\
@@ -446,6 +446,446 @@
+
+ Test
+ 0x4
+ ARM-ADS
+ 6160000::V6.16::ARMCLANG
+ 1
+
+
+ STM32F746ZGTx
+ STMicroelectronics
+ Keil.STM32F7xx_DFP.2.15.1
+ https://www.keil.com/pack/
+ IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE
+
+
+ UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN2 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FF1STM32F7xTCM_1024 -FS1200000 -FL1100000 -FP0($$Device:STM32F746ZGTx$CMSIS\Flash\STM32F7x_1024.FLM) -FP1($$Device:STM32F746ZGTx$CMSIS\Flash\STM32F7xTCM_1024.FLM))
+ 0
+ $$Device:STM32F746ZGTx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h
+
+
+
+
+
+
+
+
+
+ $$Device:STM32F746ZGTx$CMSIS\SVD\STM32F746.svd
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\Objects\
+ firmware
+ 1
+ 0
+ 1
+ 1
+ 1
+ .\Listings\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
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 0x100000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20010000
+ 0x40000
+
+
+ 0
+ 0x20000000
+ 0x10000
+
+
+
+
+
+ 1
+ 6
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+
+ -W -Wall -Wextra -Wundef -Wshadow -Wdouble-promotion -Wno-unused-parameter -Wconversion -Wno-sign-conversion -fno-common -fdata-sections
+ HTTP_URL=\"http://0.0.0.0/\" UART_DEBUG=USART1
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20010000
+
+
+
+
+
+
+
+
+
+
+
+
+ Source Group 1
+
+
+ hal.h
+ 5
+ .\hal.h
+
+
+ main.c
+ 1
+ .\main.c
+
+
+ net.c
+ 1
+ .\net.c
+
+
+ packed_fs.c
+ 1
+ .\packed_fs.c
+
+
+ syscalls.c
+ 1
+ .\syscalls.c
+
+
+ mongoose.c
+ 1
+ .\mongoose.c
+
+
+
+
+ :STM32CubeMX:Common Sources
+
+
+ main.c
+ 1
+ .\RTE\Device\STM32F746ZGTx\STCubeGenerated\Src\main.c
+
+
+ stm32f7xx_it.h
+ 5
+ .\RTE\Device\STM32F746ZGTx\STCubeGenerated\Inc\stm32f7xx_it.h
+
+
+ stm32f7xx_it.c
+ 1
+ .\RTE\Device\STM32F746ZGTx\STCubeGenerated\Src\stm32f7xx_it.c
+
+
+
+
+ ::CMSIS
+
+
+ ::Compiler
+
+
+ ::Device
+
+
+
@@ -453,6 +893,7 @@
+
@@ -461,6 +902,7 @@
+
@@ -469,72 +911,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -545,6 +999,7 @@
+
@@ -553,9 +1008,19 @@
+
+
+
+
+ device-dashboard
+ 1
+
+
+
+
diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/hal.h b/examples/stm32/nucleo-f746zg-keil-baremetal/hal.h
index 8401fe4b..37ab2e10 100644
--- a/examples/stm32/nucleo-f746zg-keil-baremetal/hal.h
+++ b/examples/stm32/nucleo-f746zg-keil-baremetal/hal.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2022-23 Cesanta Software Limited
+// Copyright (c) 2023 Cesanta Software Limited
// All rights reserved
// https://www.st.com/resource/en/reference_manual/dm00124865-stm32f75xxx-and-stm32f74xxx-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf
@@ -6,11 +6,6 @@
#include
-#ifndef UART_DEBUG
-#define UART_DEBUG USART3
-#endif
-
-
#define UUID ((uint8_t *) UID_BASE) // Unique 96-bit chip ID. TRM 41.1
// Helper macro for MAC generation
@@ -19,3 +14,30 @@
2, UUID[0] ^ UUID[1], UUID[2] ^ UUID[3], UUID[4] ^ UUID[5], \
UUID[6] ^ UUID[7] ^ UUID[8], UUID[9] ^ UUID[10] ^ UUID[11] \
}
+
+// For internal testing purposes
+#ifdef UART_DEBUG
+#include "main.h"
+#define BIT(x) (1UL << (x))
+static inline void test_init(void) {
+ USART_TypeDef *uart = USART1; // hardcode to USART1 PA9,10
+ uint32_t freq = SystemCoreClock / BIT(((RCC->CFGR >> 13) & 0x7) - 3);
+ __HAL_RCC_USART1_CLK_ENABLE();
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ GPIO_InitTypeDef GPIO_InitStruct = {.Pin = GPIO_PIN_10 | GPIO_PIN_9,
+ .Mode = GPIO_MODE_AF_PP,
+ .Pull = GPIO_NOPULL,
+ .Speed = GPIO_SPEED_FREQ_VERY_HIGH,
+ .Alternate = GPIO_AF7_USART1};
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ uart->CR1 = 0; // Disable this UART
+ uart->BRR = freq / 115200; // Set baud rate
+ uart->CR1 |= BIT(0) | BIT(2) | BIT(3); // Set UE, RE, TE
+}
+static inline void uart_write_byte(USART_TypeDef *uart, uint8_t byte) {
+ uart->TDR = byte;
+ while ((uart->ISR & BIT(7)) == 0) (void) 0;
+}
+#else
+#define test_init()
+#endif
diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/main.c b/examples/stm32/nucleo-f746zg-keil-baremetal/main.c
index 1582b33a..b2b4112a 100644
--- a/examples/stm32/nucleo-f746zg-keil-baremetal/main.c
+++ b/examples/stm32/nucleo-f746zg-keil-baremetal/main.c
@@ -36,6 +36,7 @@ int main(void) {
mx_init(); // Setup clock and all peripherals configured in CubeMX
// Initialise random number generator
// Initialise ethernet pins
+ test_init(); // for internal testing purposes only
MG_INFO(("Starting, CPU freq %g MHz", (double) SystemCoreClock / 1000000));
struct mg_mgr mgr; // Initialise
diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/syscalls.c b/examples/stm32/nucleo-f746zg-keil-baremetal/syscalls.c
index 822d1f8c..d642e9de 100644
--- a/examples/stm32/nucleo-f746zg-keil-baremetal/syscalls.c
+++ b/examples/stm32/nucleo-f746zg-keil-baremetal/syscalls.c
@@ -3,8 +3,16 @@
#include "main.h"
+#ifdef UART_DEBUG // For internal testing purposes
+#include "hal.h"
+int stdout_putchar (int ch) {
+ uart_write_byte(USART1, (uint8_t) ch);
+ return ch;
+}
+#else
int stdout_putchar (int ch) {
extern UART_HandleTypeDef huart3;
HAL_UART_Transmit(&huart3, (const uint8_t *)&ch, 1, 100);
return ch;
}
+#endif
diff --git a/test/keil/Makefile b/test/keil/Makefile
index ea9e4972..4155f5ca 100644
--- a/test/keil/Makefile
+++ b/test/keil/Makefile
@@ -1,10 +1,23 @@
# Do NOT use parenthesis on Windows project dir names
-PROJECTS = $(wildcard ../../examples/stm32/nucleo-*-keil-*)
+PROJECTS ?= $(wildcard ../../examples/stm32/nucleo-*-keil-*)
+TARGET ?= "Target 1"
all: $(PROJECTS)
# Need to test inside .bat to check and transfer errors
$(PROJECTS): FORCE
- unitest.bat $(subst /,\,$@)
+ unitest.bat $(subst /,\,$@) $(TARGET)
FORCE:
+
+# Automated remote test. See https://vcon.io/automated-firmware-tests/
+URL ?= https://dash.vcon.io/api/v3/devices
+update: $(PROJECTS)
+ curl -su :$(VCON_API_KEY) $(URL)/$(DEVICE)/ota?hex=1 --data-binary @$