Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
board: [discoveryf4, discoveryf429, netduinoplus2]

steps:
- uses: actions/checkout@v6

- name: Install ARM toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi

- name: Configure for ${{ matrix.board }}
run: make ${{ matrix.board }}_defconfig

- name: Build kernel
run: make

- name: Show binary size
run: arm-none-eabi-size build/${{ matrix.board }}/f9.elf

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: f9-${{ matrix.board }}
path: |
build/${{ matrix.board }}/f9.elf
build/${{ matrix.board }}/f9.bin

qemu-test:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v6

- name: Download netduinoplus2 artifact
uses: actions/download-artifact@v4
with:
name: f9-netduinoplus2
path: build/netduinoplus2

- name: Install QEMU
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-arm

- name: QEMU boot test
run: |
timeout 15s qemu-system-arm \
-M netduinoplus2 \
-nographic \
-serial mon:stdio \
-kernel build/netduinoplus2/f9.elf 2>&1 | tee qemu.log || true

echo "=== QEMU Output ==="
cat qemu.log
echo "==================="

# Check for successful boot indicators
if grep -q "Press '?' to print KDB menu" qemu.log; then
echo "✓ KDB shell ready"
exit 0
elif grep -q "KDB" qemu.log; then
echo "✓ KDB initialized"
exit 0
elif grep -q "f9" qemu.log || grep -q "F9" qemu.log; then
echo "✓ Kernel boot detected"
exit 0
fi

# Check for crash indicators
if grep -q "MEMFAULT\|HardFault\|panic" qemu.log; then
echo "✗ Kernel crash detected"
exit 1
fi

echo "⚠ No boot message detected (timeout or minimal output)"
exit 0
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ endif

ifeq "$(CONFIG_BOARD_STM32F429DISCOVERY)" "y"
BOARD ?= discoveryf429
else ifeq "$(CONFIG_BOARD_STM32P103)" "y"
BOARD ?= stm32p103
else ifeq "$(CONFIG_BOARD_NETDUINOPLUS2)" "y"
BOARD ?= netduinoplus2
else
BOARD ?= discoveryf4
endif
Expand All @@ -30,9 +30,9 @@ out ?= build/$(BOARD)
# output directory for host build targets
out_host ?= build/host

# FIXME: use smarter way to detect QEMU
# qemu directory location
QEMU_DIR ?= ../qemu_stm32/arm-softmmu/
# QEMU command for netduinoplus2 emulation
# Usage: qemu-system-arm -M netduinoplus2 -nographic -kernel build/netduinoplus2/f9.elf
QEMU ?= qemu-system-arm

includes-user = user/include
# toolchain specific configurations; common cflags and ldflags
Expand Down
23 changes: 16 additions & 7 deletions board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,26 @@ config BOARD_STM32F429DISCOVERY
help
STM32F429 Discovery board with STM32F429ZIT6 MCU and LCD.

config BOARD_STM32P103
bool "Olimex STM32-P103"
select PLATFORM_STM32F1
config BOARD_NETDUINOPLUS2
bool "Netduino Plus 2"
select PLATFORM_STM32F4
help
Olimex STM32-P103 board with STM32F103RBT6 MCU.
Netduino Plus 2 board with STM32F405RGT6 MCU.
This board is supported by upstream QEMU for emulation.

endchoice

config QEMU
bool "QEMU emulation mode"
default y if BOARD_NETDUINOPLUS2
help
Enable workarounds for QEMU emulation limitations:
- Use synchronous UART output (QEMU TXE interrupt unreliable)
- Place bitmaps in regular SRAM (QEMU lacks CCM RAM emulation)

Enable this when running under QEMU. Disable for real hardware
to get better performance.

endmenu

# Platform symbols (selected by board choice)
Expand All @@ -38,6 +50,3 @@ config PLATFORM_STM32F4

config PLATFORM_STM32F429
bool

config PLATFORM_STM32F1
bool
2 changes: 1 addition & 1 deletion board/discoveryf4/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
CONFIG_BOARD_STM32F4DISCOVERY=y
# CONFIG_BOARD_STM32F429DISCOVERY is not set
# CONFIG_BOARD_STM32P103 is not set
# CONFIG_BOARD_NETDUINOPLUS2 is not set
# CONFIG_BITMAP_BITBAND is not set
# CONFIG_FPU is not set
# CONFIG_STDIO_NODEV is not set
Expand Down
2 changes: 1 addition & 1 deletion board/discoveryf429/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# CONFIG_BOARD_STM32F4DISCOVERY is not set
CONFIG_BOARD_STM32F429DISCOVERY=y
# CONFIG_BOARD_STM32P103 is not set
# CONFIG_BOARD_NETDUINOPLUS2 is not set
# CONFIG_BITMAP_BITBAND is not set
# CONFIG_FPU is not set
# CONFIG_STDIO_NODEV is not set
Expand Down
18 changes: 11 additions & 7 deletions board/stm32p103/board.c → board/netduinoplus2/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@
* found in the LICENSE file.
*/

#include <platform/stm32f1/gpio.h>
#include <platform/stm32f1/usart.h>
#include <platform/stm32f4/gpio.h>
#include <platform/stm32f4/usart.h>
#include "board.h"

struct usart_dev console_uart = {
.u_num = 3,
.u_num = 2,
.baud = 115200,
BOARD_USART_CONFIGS
.tx = {
.port = BOARD_USART_TX_IO_PORT,
.pin = BOARD_USART_TX_IO_PIN,
.mode = GPIO_MODE_OUT_ALT_PP,
.pupd = GPIO_PUPDR_NONE,
.type = GPIO_MODER_ALT,
.func = BOARD_USART_FUNC,
.ospeed = GPIO_OSPEED_50M,
.o_type = GPIO_OTYPER_PP,
.speed = GPIO_OSPEEDR_50M,
},
.rx = {
.port = BOARD_USART_RX_IO_PORT,
.pin = BOARD_USART_RX_IO_PIN,
.mode = GPIO_MODE_OUT_ALT_PP,
.pupd = GPIO_PUPDR_NONE,
.type = GPIO_MODER_ALT,
.func = BOARD_USART_FUNC,
.ospeed = GPIO_OSPEED_50M,
.o_type = GPIO_OTYPER_PP,
.speed = GPIO_OSPEEDR_50M,
},
};
50 changes: 26 additions & 24 deletions board/stm32p103/board.h → board/netduinoplus2/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* found in the LICENSE file.
*/

#ifndef STM32P103_BOARD_H_
#define STM32P103_BOARD_H_
#ifndef NETDUINOPLUS2_BOARD_H_
#define NETDUINOPLUS2_BOARD_H_

#include <platform/stm32f1/registers.h>
#include <platform/stm32f1/gpio.h>
#include <platform/stm32f1/usart.h>
#include <platform/stm32f1/nvic.h>
#include <platform/stm32f1/systick.h>
#include <platform/stm32f4/registers.h>
#include <platform/stm32f4/gpio.h>
#include <platform/stm32f4/usart.h>
#include <platform/stm32f4/nvic.h>
#include <platform/stm32f4/systick.h>

extern struct usart_dev console_uart;

Expand All @@ -28,8 +28,25 @@ extern struct usart_dev console_uart;
#define BOARD_USART_RX_IO_PORT GPIOA
#define BOARD_USART_RX_IO_PIN 10

#elif defined(CONFIG_DBGPORT_USE_USART4)

#elif defined(CONFIG_DBGPORT_USE_USART2)
#define BOARD_UART_DEVICE UART4_IRQn
#define BOARD_UART_HANDLER UART4_HANDLER
#define BOARD_USART_FUNC af_uart4
#define BOARD_USART_CONFIGS \
.base = UART4_BASE, \
.rcc_apbenr = RCC_UART4_APBENR, \
.rcc_reset = RCC_APB1RSTR_USART4RST,
#define BOARD_USART_TX_IO_PORT GPIOA
#define BOARD_USART_TX_IO_PIN 0
#define BOARD_USART_RX_IO_PORT GPIOA
#define BOARD_USART_RX_IO_PIN 1

#else /* default: USART2 */
/* CONFIG_DBGPORT_USE_USART2
* Note: QEMU routes USART1 to the console by default.
* Use CONFIG_DBGPORT_USE_USART1 for QEMU emulation.
*/

#define BOARD_UART_DEVICE USART2_IRQn
#define BOARD_UART_HANDLER USART2_HANDLER
Expand All @@ -43,21 +60,6 @@ extern struct usart_dev console_uart;
#define BOARD_USART_RX_IO_PORT GPIOA
#define BOARD_USART_RX_IO_PIN 3

#else /* default: USART3 */
/* CONFIG_DBGPORT_USE_USART3 */

#define BOARD_UART_DEVICE USART3_IRQn
#define BOARD_UART_HANDLER USART3_HANDLER
#define BOARD_USART_FUNC 0
#define BOARD_USART_CONFIGS \
.base = USART3_BASE, \
.rcc_apbenr = RCC_USART3_APBENR, \
.rcc_reset = RCC_APB1RSTR_USART3RST,
#define BOARD_USART_TX_IO_PORT GPIOB
#define BOARD_USART_TX_IO_PIN 10
#define BOARD_USART_RX_IO_PORT GPIOB
#define BOARD_USART_RX_IO_PIN 11

#endif

#endif /* STM32P103_BOARD_H_ */
#endif /* NETDUINOPLUS2_BOARD_H_ */
6 changes: 3 additions & 3 deletions board/stm32p103/build.mk → board/netduinoplus2/build.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2014 The F9 Microkernel Project. All rights reserved.
# Copyright (c) 2013 The F9 Microkernel Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

CHIP := stm32f1
CHIP := stm32f4
PLATFORM := stm32
STM32_VARIANT := f1
STM32_VARIANT := f4

board-y = board.o
loader-board-y = board.loader.o
Loading