diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 2618d965..1eed5e48 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -136,6 +136,13 @@ jobs:
run: make -C examples/stm32/nucleo-f746zg-freertos test VCON_API_KEY=${{secrets.VCON_API_KEY}}
- if: ${{ env.GO == 1 }}
run: make -C examples/stm32/nucleo-f746zg-freertos-tcp test VCON_API_KEY=${{secrets.VCON_API_KEY}}
+ - run: echo GO=0 >> $GITHUB_ENV ; if ./test/match_changed_files.sh '^src|examples/stm32/nucleo-f7.*-cube-'; then echo GO=1 >> $GITHUB_ENV ; fi
+ - if: ${{ env.GO == 1 }}
+ run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-baremetal VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
+ - if: ${{ env.GO == 1 }}
+ run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
+ - if: ${{ env.GO == 1 }}
+ run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
test_f4:
runs-on: ubuntu-latest
@@ -149,9 +156,6 @@ jobs:
run: make -C examples/stm32/nucleo-f429zi-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
- if: ${{ env.GO == 1 }}
run: make -C examples/stm32/nucleo-f429zi-freertos test VCON_API_KEY=${{secrets.VCON_API_KEY}}
- - run: echo GO=0 >> $GITHUB_ENV ; if ./test/match_changed_files.sh '^src|examples/stm32/nucleo-f4*-cube-*'; then echo GO=1 >> $GITHUB_ENV ; fi
- - if: ${{ env.GO == 1 }}
- run: make -f test/cube/Makefile examples/stm32/nucleo-f429zi-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
test_h7:
runs-on: ubuntu-latest
diff --git a/examples/stm32/nucleo-f746zg-cube-baremetal/.cproject b/examples/stm32/nucleo-f746zg-cube-baremetal/.cproject
index ab4a166d..127f3974 100644
--- a/examples/stm32/nucleo-f746zg-cube-baremetal/.cproject
+++ b/examples/stm32/nucleo-f746zg-cube-baremetal/.cproject
@@ -160,6 +160,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/stm32/nucleo-f746zg-cube-baremetal/.settings/language.settings.xml b/examples/stm32/nucleo-f746zg-cube-baremetal/.settings/language.settings.xml
index 6270f1c1..964acf89 100644
--- a/examples/stm32/nucleo-f746zg-cube-baremetal/.settings/language.settings.xml
+++ b/examples/stm32/nucleo-f746zg-cube-baremetal/.settings/language.settings.xml
@@ -22,4 +22,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Inc/hal.h b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Inc/hal.h
index a0ec0b30..ad048d99 100644
--- a/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Inc/hal.h
+++ b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Inc/hal.h
@@ -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,32 @@
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
+#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;
+}
+static inline void uart_write_buf(USART_TypeDef *uart, char *buf, size_t len) {
+ while (len-- > 0) uart_write_byte(uart, *(uint8_t *) buf++);
+}
+#else
+#define test_init()
+#endif
diff --git a/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c
index 1707ea3b..e569ce74 100644
--- a/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c
+++ b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c
@@ -142,6 +142,7 @@ int main(void)
MX_RNG_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
+ 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-cube-baremetal/Core/Src/syscalls.c b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/syscalls.c
index 8cb13837..4fae7632 100644
--- a/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/syscalls.c
+++ b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/syscalls.c
@@ -78,6 +78,13 @@ __attribute__((weak)) int _read(int file, char *ptr, int len)
return len;
}
+#ifdef UART_DEBUG // For internal testing purposes
+#include "hal.h"
+int _write(int file, char *ptr, int len) {
+ if (file == 1) uart_write_buf(USART1, ptr, len);
+ return len;
+}
+#else
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
// (void)file;
@@ -89,9 +96,9 @@ __attribute__((weak)) int _write(int file, char *ptr, int len)
// }
extern UART_HandleTypeDef huart3;
if (file == 1) HAL_UART_Transmit(&huart3, (uint8_t *)ptr, len, 1000);
-
return len;
}
+#endif
int _close(int file)
{
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.cproject b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.cproject
index 980ad123..1a82765e 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.cproject
+++ b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.cproject
@@ -205,6 +205,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.settings/language.settings.xml b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.settings/language.settings.xml
index 6270f1c1..098dfebb 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.settings/language.settings.xml
+++ b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/.settings/language.settings.xml
@@ -22,4 +22,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Inc/hal.h b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Inc/hal.h
index a0ec0b30..ad048d99 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Inc/hal.h
+++ b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Inc/hal.h
@@ -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,32 @@
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
+#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;
+}
+static inline void uart_write_buf(USART_TypeDef *uart, char *buf, size_t len) {
+ while (len-- > 0) uart_write_byte(uart, *(uint8_t *) buf++);
+}
+#else
+#define test_init()
+#endif
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/main.c b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/main.c
index 53c0d768..724649b0 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/main.c
+++ b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/main.c
@@ -113,6 +113,7 @@ int main(void)
MX_RNG_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
+ test_init(); // for internal testing purposes only
/* USER CODE END 2 */
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/syscalls.c b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/syscalls.c
index 8cb13837..4fae7632 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/syscalls.c
+++ b/examples/stm32/nucleo-f746zg-cube-freertos-lwip/Core/Src/syscalls.c
@@ -78,6 +78,13 @@ __attribute__((weak)) int _read(int file, char *ptr, int len)
return len;
}
+#ifdef UART_DEBUG // For internal testing purposes
+#include "hal.h"
+int _write(int file, char *ptr, int len) {
+ if (file == 1) uart_write_buf(USART1, ptr, len);
+ return len;
+}
+#else
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
// (void)file;
@@ -89,9 +96,9 @@ __attribute__((weak)) int _write(int file, char *ptr, int len)
// }
extern UART_HandleTypeDef huart3;
if (file == 1) HAL_UART_Transmit(&huart3, (uint8_t *)ptr, len, 1000);
-
return len;
}
+#endif
int _close(int file)
{
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos/.cproject b/examples/stm32/nucleo-f746zg-cube-freertos/.cproject
index aaef7418..ce371f2d 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos/.cproject
+++ b/examples/stm32/nucleo-f746zg-cube-freertos/.cproject
@@ -168,6 +168,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos/.settings/language.settings.xml b/examples/stm32/nucleo-f746zg-cube-freertos/.settings/language.settings.xml
index 6270f1c1..fc5c3793 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos/.settings/language.settings.xml
+++ b/examples/stm32/nucleo-f746zg-cube-freertos/.settings/language.settings.xml
@@ -22,4 +22,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos/Core/Inc/hal.h b/examples/stm32/nucleo-f746zg-cube-freertos/Core/Inc/hal.h
index a0ec0b30..ad048d99 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos/Core/Inc/hal.h
+++ b/examples/stm32/nucleo-f746zg-cube-freertos/Core/Inc/hal.h
@@ -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,32 @@
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
+#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;
+}
+static inline void uart_write_buf(USART_TypeDef *uart, char *buf, size_t len) {
+ while (len-- > 0) uart_write_byte(uart, *(uint8_t *) buf++);
+}
+#else
+#define test_init()
+#endif
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/main.c b/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/main.c
index eb0250b2..94118d29 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/main.c
+++ b/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/main.c
@@ -155,6 +155,7 @@ int main(void)
MX_RNG_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
+ test_init(); // for internal testing purposes only
/* USER CODE END 2 */
diff --git a/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/syscalls.c b/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/syscalls.c
index 8cb13837..4fae7632 100644
--- a/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/syscalls.c
+++ b/examples/stm32/nucleo-f746zg-cube-freertos/Core/Src/syscalls.c
@@ -78,6 +78,13 @@ __attribute__((weak)) int _read(int file, char *ptr, int len)
return len;
}
+#ifdef UART_DEBUG // For internal testing purposes
+#include "hal.h"
+int _write(int file, char *ptr, int len) {
+ if (file == 1) uart_write_buf(USART1, ptr, len);
+ return len;
+}
+#else
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
// (void)file;
@@ -89,9 +96,9 @@ __attribute__((weak)) int _write(int file, char *ptr, int len)
// }
extern UART_HandleTypeDef huart3;
if (file == 1) HAL_UART_Transmit(&huart3, (uint8_t *)ptr, len, 1000);
-
return len;
}
+#endif
int _close(int file)
{