diff --git a/software/CMakeLists.txt b/software/CMakeLists.txt index 6c308a9..794041c 100644 --- a/software/CMakeLists.txt +++ b/software/CMakeLists.txt @@ -1,8 +1,6 @@ -# Top-level CMakeLists.txt for the irrigation system project +# Top-level CMakeLists.txt for the multi-app setup cmake_minimum_required(VERSION 3.20) -# Add the subdirectories for the applications and libraries add_subdirectory(apps/gateway) -add_subdirectory(apps/slave_node) -add_subdirectory(lib) +add_subdirectory(apps/slave_node) \ No newline at end of file diff --git a/software/apps/gateway/prj.conf b/software/apps/gateway/prj.conf index 8852f15..9142e42 100644 --- a/software/apps/gateway/prj.conf +++ b/software/apps/gateway/prj.conf @@ -1,3 +1,2 @@ -# Zephyr configuration for the Gateway +# Gateway Configuration CONFIG_NETWORKING=y -CONFIG_NET_TCP=y diff --git a/software/apps/slave_node/CMakeLists.txt b/software/apps/slave_node/CMakeLists.txt index ded1612..1b466e4 100644 --- a/software/apps/slave_node/CMakeLists.txt +++ b/software/apps/slave_node/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.20) +# Point BOARD_ROOT and DTS_ROOT to the main 'software' directory +# so Zephyr can find the 'boards' subdirectory there. +list(APPEND BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) +list(APPEND DTS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) + find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(slave_node) -target_sources(app PRIVATE src/main.c) +target_sources(app PRIVATE src/main.c) \ No newline at end of file diff --git a/software/apps/slave_node/prj.conf b/software/apps/slave_node/prj.conf index cc14a96..1777e80 100644 --- a/software/apps/slave_node/prj.conf +++ b/software/apps/slave_node/prj.conf @@ -1,2 +1,7 @@ -# Zephyr configuration for the Slave Node +# --- Base Slave Node Config --- CONFIG_GPIO=y + +# Use RTT for console output instead of UART +CONFIG_USE_SEGGER_RTT=y +CONFIG_RTT_CONSOLE=y +CONFIG_UART_CONSOLE=n diff --git a/software/apps/slave_node/src/main.c b/software/apps/slave_node/src/main.c index e831e3f..c5e0746 100644 --- a/software/apps/slave_node/src/main.c +++ b/software/apps/slave_node/src/main.c @@ -8,6 +8,9 @@ int main(void) { - printk("Hello from Slave Node!\n"); + while (1) { + printk("Hello from Slave Node!\n"); + k_msleep(1000); + } return 0; } diff --git a/software/boards/iten/bluepill_f103rb/Kconfig.bluepill_f103rb b/software/boards/iten/bluepill_f103rb/Kconfig.bluepill_f103rb new file mode 100644 index 0000000..56c895d --- /dev/null +++ b/software/boards/iten/bluepill_f103rb/Kconfig.bluepill_f103rb @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Eduard Iten +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_BLUEPILL_F103RB + select SOC_STM32F103XB diff --git a/software/boards/iten/bluepill_f103rb/bluepill_f103rb.dts b/software/boards/iten/bluepill_f103rb/bluepill_f103rb.dts new file mode 100644 index 0000000..e5a7f38 --- /dev/null +++ b/software/boards/iten/bluepill_f103rb/bluepill_f103rb.dts @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2025 Eduard Iten + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include +#include + +/ { + model = "Blue-Pill STM32F103RB"; + compatible = "iten,bluepill-f103rb"; + + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + led_status: led_status { + gpios = <&gpioc 13 GPIO_ACTIVE_LOW>; + label = "User LED"; + }; + }; + + aliases { + led0 = &led_status; + watchdog0 = &iwdg; + }; +}; + + +&clk_lsi { + status = "okay"; +}; + +&clk_hse { + clock-frequency = ; + status = "okay"; +}; + +&pll { + mul = <9>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <2>; + apb2-prescaler = <1>; + adc-prescaler = <6>; +}; + + +&usart1 { + pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&iwdg { + status = "okay"; +}; + + +&clk_lsi { + status = "okay"; +}; + +&clk_hse { + clock-frequency = ; + status = "okay"; +}; + +&pll { + mul = <9>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <2>; + apb2-prescaler = <1>; + adc-prescaler = <6>; +}; + +&exti { + status = "okay"; +}; + +&dma1 { + status = "okay"; +}; diff --git a/software/boards/iten/bluepill_f103rb/bluepill_f103rb_defconfig b/software/boards/iten/bluepill_f103rb/bluepill_f103rb_defconfig new file mode 100644 index 0000000..75ccdf5 --- /dev/null +++ b/software/boards/iten/bluepill_f103rb/bluepill_f103rb_defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Eduard Iten +# SPDX-License-Identifier: Apache-2.0 +CONFIG_SERIAL=y +CONFIG_GPIO=y \ No newline at end of file diff --git a/software/boards/iten/bluepill_f103rb/board.cmake b/software/boards/iten/bluepill_f103rb/board.cmake new file mode 100644 index 0000000..49423e5 --- /dev/null +++ b/software/boards/iten/bluepill_f103rb/board.cmake @@ -0,0 +1,12 @@ +# Copyright (c) 2025 Eduard Iten +# SPDX-License-Identifier: Apache-2.0 + +# keep first +board_runner_args(jlink "--device=STM32F103RB" "--speed=4000") +board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") + +# keep first +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd-stm32.board.cmake) +include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) diff --git a/software/boards/iten/bluepill_f103rb/board.yml b/software/boards/iten/bluepill_f103rb/board.yml new file mode 100644 index 0000000..b8aa3ef --- /dev/null +++ b/software/boards/iten/bluepill_f103rb/board.yml @@ -0,0 +1,8 @@ +# Copyright (c) 2025 Eduard Iten +# SPDX-License-Identifier: Apache-2.0 + +board: + name: bluepill_f103rb + vendor: iten + socs: + - name: stm32f103xb \ No newline at end of file