diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..05bbee8 Binary files /dev/null and b/.DS_Store differ diff --git a/005_bootloader_usage/.DS_Store b/005_bootloader_usage/.DS_Store new file mode 100644 index 0000000..d7bdafc Binary files /dev/null and b/005_bootloader_usage/.DS_Store differ diff --git a/005_bootloader_usage/CMakeLists.txt b/005_bootloader_usage/CMakeLists.txt index 381ad05..ec1ef17 100644 --- a/005_bootloader_usage/CMakeLists.txt +++ b/005_bootloader_usage/CMakeLists.txt @@ -8,4 +8,3 @@ project(004_create_your_own_board) target_sources(app PRIVATE src/main.c) - diff --git a/005_bootloader_usage/boards/barth/stg_800/Kconfig.defconfig b/005_bootloader_usage/boards/barth/stg_800/Kconfig.defconfig deleted file mode 100644 index bca4b9d..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/Kconfig.defconfig +++ /dev/null @@ -1,12 +0,0 @@ -# STG-800 PLC board by BARTH - -# Copyright (c) 2017 Bobby Noelte -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_STG_800 - -config SPI_STM32_INTERRUPT - default y - depends on SPI - -endif # BOARD_STG_800 diff --git a/005_bootloader_usage/boards/barth/stg_800/Kconfig.stg_800 b/005_bootloader_usage/boards/barth/stg_800/Kconfig.stg_800 deleted file mode 100644 index a1c372a..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/Kconfig.stg_800 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2017 Bobby Noelte -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_STG_800 - select SOC_STM32F091XC diff --git a/005_bootloader_usage/boards/barth/stg_800/arduino_r3_connector.dtsi b/005_bootloader_usage/boards/barth/stg_800/arduino_r3_connector.dtsi deleted file mode 100644 index bccf9e6..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/arduino_r3_connector.dtsi +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019 Linaro Limited - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - arduino_header: connector { - compatible = "arduino-header-r3"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <0 0 &gpioa 0 0>, /* A0 */ - <1 0 &gpioa 1 0>, /* A1 */ - <2 0 &gpioa 4 0>, /* A2 */ - <3 0 &gpiob 0 0>, /* A3 */ - <4 0 &gpioc 1 0>, /* A4 */ - <5 0 &gpioc 0 0>, /* A5 */ - <6 0 &gpioa 3 0>, /* D0 */ - <7 0 &gpioa 2 0>, /* D1 */ - <8 0 &gpioa 10 0>, /* D2 */ - <9 0 &gpiob 3 0>, /* D3 */ - <10 0 &gpiob 5 0>, /* D4 */ - <11 0 &gpiob 4 0>, /* D5 */ - <12 0 &gpiob 10 0>, /* D6 */ - <13 0 &gpioa 8 0>, /* D7 */ - <14 0 &gpioa 9 0>, /* D8 */ - <15 0 &gpioc 7 0>, /* D9 */ - <16 0 &gpiob 6 0>, /* D10 */ - <17 0 &gpioa 7 0>, /* D11 */ - <18 0 &gpioa 6 0>, /* D12 */ - <19 0 &gpioa 5 0>, /* D13 */ - <20 0 &gpiob 9 0>, /* D14 */ - <21 0 &gpiob 8 0>; /* D15 */ - }; -}; - -arduino_i2c: &i2c1 {}; -arduino_spi: &spi1 {}; diff --git a/005_bootloader_usage/boards/barth/stg_800/board.cmake b/005_bootloader_usage/boards/barth/stg_800/board.cmake deleted file mode 100644 index 442619a..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/board.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -board_runner_args(jlink "--device=STM32F091CC" "--speed=4000") - -include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) -include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/005_bootloader_usage/boards/barth/stg_800/board.yml b/005_bootloader_usage/boards/barth/stg_800/board.yml deleted file mode 100644 index 8a8e9eb..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/board.yml +++ /dev/null @@ -1,5 +0,0 @@ -board: - name: stg_800 - vendor: st - socs: - - name: stm32f091xc diff --git a/005_bootloader_usage/boards/barth/stg_800/doc/img/nucleo_f091rc.jpg b/005_bootloader_usage/boards/barth/stg_800/doc/img/nucleo_f091rc.jpg deleted file mode 100644 index addc9b7..0000000 Binary files a/005_bootloader_usage/boards/barth/stg_800/doc/img/nucleo_f091rc.jpg and /dev/null differ diff --git a/005_bootloader_usage/boards/barth/stg_800/doc/img/nucleo_f091rc_connectors.jpg b/005_bootloader_usage/boards/barth/stg_800/doc/img/nucleo_f091rc_connectors.jpg deleted file mode 100644 index 2429be9..0000000 Binary files a/005_bootloader_usage/boards/barth/stg_800/doc/img/nucleo_f091rc_connectors.jpg and /dev/null differ diff --git a/005_bootloader_usage/boards/barth/stg_800/doc/index.rst b/005_bootloader_usage/boards/barth/stg_800/doc/index.rst deleted file mode 100644 index a83b00b..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/doc/index.rst +++ /dev/null @@ -1,199 +0,0 @@ -.. _nucleo_f091rc_board: - -ST Nucleo F091RC -################ - -Overview -******** -The STM32 Nucleo-64 development board with STM32F091RC MCU, supports Arduino and ST morpho connectivity. - -The STM32 Nucleo board provides an affordable, and flexible way for users to try out new concepts, -and build prototypes with the STM32 microcontroller, choosing from the various -combinations of performance, power consumption, and features. - -The Arduino* Uno V3 connectivity support and the ST morpho headers allow easy functionality -expansion of the STM32 Nucleo open development platform with a wide choice of -specialized shields. - -The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. - -The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together -with various packaged software examples. - -.. image:: img/nucleo_f091rc.jpg - :align: center - :alt: Nucleo F091RC - -More information about the board can be found at the `Nucleo F091RC website`_. - -Hardware -******** -Nucleo F091RC provides the following hardware components: - -- STM32 microcontroller in QFP64 package -- Two types of extension resources: - - - Arduino* Uno V3 connectivity - - ST morpho extension pin headers for full access to all STM32 I/Os - -- ARM* mbed* -- On-board ST-LINK/V2-1 debugger/programmer with SWD connector: - - - Selection-mode switch to use the kit as a standalone ST-LINK/V2-1 - -- Flexible board power supply: - - - USB VBUS or external source (3.3V, 5V, 7 - 12V) - - Power management access point - -- Three LEDs: - - - USB communication (LD1), user LED (LD2), power LED (LD3) - -- Two push-buttons: USER and RESET -- USB re-enumeration capability. Three different interfaces supported on USB: - - - Virtual COM port - - Mass storage - - Debug port - -- Support of wide choice of Integrated Development Environments (IDEs) including: - - - IAR - - ARM Keil - - GCC-based IDEs - -More information about STM32F091RC can be found in the -`STM32F091 reference manual`_ - - -Supported Features -================== - -The Zephyr nucleo_f091rc board configuration supports the following hardware features: - -+-----------+------------+-------------------------------------+ -| Interface | Controller | Driver/Component | -+===========+============+=====================================+ -| NVIC | on-chip | nested vector interrupt controller | -+-----------+------------+-------------------------------------+ -| UART | on-chip | serial port-polling; | -| | | serial port-interrupt | -+-----------+------------+-------------------------------------+ -| PINMUX | on-chip | pinmux | -+-----------+------------+-------------------------------------+ -| GPIO | on-chip | gpio | -+-----------+------------+-------------------------------------+ -| CLOCK | on-chip | reset and clock control | -+-----------+------------+-------------------------------------+ -| FLASH | on-chip | flash memory | -+-----------+------------+-------------------------------------+ -| WATCHDOG | on-chip | independent watchdog | -+-----------+------------+-------------------------------------+ -| PWM | on-chip | pwm | -+-----------+------------+-------------------------------------+ -| COUNTER | on-chip | rtc | -+-----------+------------+-------------------------------------+ -| I2C | on-chip | i2c controller | -+-----------+------------+-------------------------------------+ -| SPI | on-chip | SPI controller | -+-----------+------------+-------------------------------------+ -| CAN | on-chip | CAN controller | -+-----------+------------+-------------------------------------+ -| ADC | on-chip | ADC controller | -+-----------+------------+-------------------------------------+ -| DAC | on-chip | DAC controller | -+-----------+------------+-------------------------------------+ -| DMA | on-chip | Direct Memory Access | -+-----------+------------+-------------------------------------+ -| die-temp | on-chip | die temperature sensor | -+-----------+------------+-------------------------------------+ -| RTC | on-chip | rtc | -+-----------+------------+-------------------------------------+ - -Other hardware features are not yet supported in this Zephyr port. - -The default configuration can be found in -:zephyr_file:`boards/st/nucleo_f091rc/nucleo_f091rc_defconfig` - -Connections and IOs -=================== - -Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as -input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the -GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current -capable except for analog inputs. - -Board connectors: ------------------ -.. image:: img/nucleo_f091rc_connectors.jpg - :align: center - :alt: Nucleo F091RC connectors - -Default Zephyr Peripheral Mapping: ----------------------------------- - -- UART_1 TX/RX : PB6/PB7 -- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual COM Port) -- I2C1 SCL/SDA : PB8/PB9 (Arduino I2C) -- I2C2 SCL/SDA : PA11/PA12 (disabled by default, uses same pins as CAN) -- CAN RX/TX : PA11/PA12 -- SPI1 SCK/MISO/MOSI : PA5/PA6/PA7 (Arduino SPI) -- SPI2 SCK/MISO/MOSI : PB13/PB14/PB15 -- USER_PB : PC13 -- LD2 : PA5 -- DAC_OUT1 : PA4 -- PWM_2_CH1 : PA5 (might conflict with SPI1) - -For more details please refer to `STM32 Nucleo-64 board User Manual`_. - -Programming and Debugging -************************* - -Applications for the ``nucleo_f091rc`` board configuration can be built and -flashed in the usual way (see :ref:`build_an_application` and -:ref:`application_run` for more details). - -Flashing -======== - -Nucleo F091RC board includes an ST-LINK/V2-1 embedded debug tool interface. -This interface is supported by the openocd version included in the Zephyr SDK. - -Flashing an application to Nucleo F091RC ----------------------------------------- - -Here is an example for the :zephyr:code-sample:`blinky` application. - -.. zephyr-app-commands:: - :zephyr-app: samples/basic/blinky - :board: nucleo_f091rc - :goals: build flash - -You will see the LED blinking every second. - -Debugging -========= - -You can debug an application in the usual way. Here is an example for the -:ref:`hello_world` application. - -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: nucleo_f091rc - :maybe-skip-config: - :goals: debug - -References -********** - -.. target-notes:: - -.. _Nucleo F091RC website: - https://www.st.com/en/evaluation-tools/nucleo-f091rc.html - -.. _STM32F091 reference manual: - https://www.st.com/resource/en/reference_manual/dm00031936.pdf - -.. _STM32 Nucleo-64 board User Manual: - https://www.st.com/resource/en/user_manual/dm00105823.pdf diff --git a/005_bootloader_usage/boards/barth/stg_800/st_morpho_connector.dtsi b/005_bootloader_usage/boards/barth/stg_800/st_morpho_connector.dtsi deleted file mode 100644 index 900d502..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/st_morpho_connector.dtsi +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2023 Marcin Niestroj - * SPDX-License-Identifier: Apache-2.0 - */ - -#include <zephyr/dt-bindings/gpio/gpio.h> -#include <zephyr/dt-bindings/gpio/st-morpho-header.h> - -/ { - st_morpho_header: st-morpho-header { - compatible = "st-morpho-header"; - #gpio-cells = <2>; - gpio-map-mask = <ST_MORPHO_PIN_MASK 0x0>; - gpio-map-pass-thru = <0x0 GPIO_DT_FLAGS_MASK>; - gpio-map = <ST_MORPHO_L_1 0 &gpioc 10 0>, - <ST_MORPHO_L_2 0 &gpioc 11 0>, - <ST_MORPHO_L_3 0 &gpioc 12 0>, - <ST_MORPHO_L_4 0 &gpiod 2 0>, - <ST_MORPHO_L_7 0 &gpiof 11 0>, - <ST_MORPHO_L_13 0 &gpioa 13 0>, - <ST_MORPHO_L_15 0 &gpioa 14 0>, - <ST_MORPHO_L_17 0 &gpioa 15 0>, - <ST_MORPHO_L_21 0 &gpiob 7 0>, - <ST_MORPHO_L_23 0 &gpioc 13 0>, - <ST_MORPHO_L_25 0 &gpioc 14 0>, - <ST_MORPHO_L_27 0 &gpioc 15 0>, - <ST_MORPHO_L_28 0 &gpioa 0 0>, - <ST_MORPHO_L_29 0 &gpiof 0 0>, - <ST_MORPHO_L_30 0 &gpioa 1 0>, - <ST_MORPHO_L_31 0 &gpiof 1 0>, - <ST_MORPHO_L_32 0 &gpioa 4 0>, - <ST_MORPHO_L_34 0 &gpiob 0 0>, - <ST_MORPHO_L_35 0 &gpioc 2 0>, - <ST_MORPHO_L_36 0 &gpioc 1 0>, /* SB56=ON, SB46=OFF */ - <ST_MORPHO_L_37 0 &gpioc 3 0>, - <ST_MORPHO_L_38 0 &gpioc 0 0>, /* SB51=ON, SB52=OFF */ - <ST_MORPHO_R_1 0 &gpioc 9 0>, - <ST_MORPHO_R_2 0 &gpioc 8 0>, - <ST_MORPHO_R_3 0 &gpiob 8 0>, - <ST_MORPHO_R_4 0 &gpioc 6 0>, - <ST_MORPHO_R_5 0 &gpiob 9 0>, - <ST_MORPHO_R_6 0 &gpioc 5 0>, - <ST_MORPHO_R_11 0 &gpioa 5 0>, - <ST_MORPHO_R_12 0 &gpioa 12 0>, - <ST_MORPHO_R_13 0 &gpioa 6 0>, - <ST_MORPHO_R_14 0 &gpioa 11 0>, - <ST_MORPHO_R_15 0 &gpioa 7 0>, - <ST_MORPHO_R_16 0 &gpiob 12 0>, - <ST_MORPHO_R_17 0 &gpiob 6 0>, - <ST_MORPHO_R_18 0 &gpiob 11 0>, - <ST_MORPHO_R_19 0 &gpioc 7 0>, - <ST_MORPHO_R_21 0 &gpioa 9 0>, - <ST_MORPHO_R_22 0 &gpiob 2 0>, - <ST_MORPHO_R_23 0 &gpioa 8 0>, - <ST_MORPHO_R_24 0 &gpiob 1 0>, - <ST_MORPHO_R_25 0 &gpiob 10 0>, - <ST_MORPHO_R_26 0 &gpiob 15 0>, - <ST_MORPHO_R_27 0 &gpiob 4 0>, - <ST_MORPHO_R_28 0 &gpiob 14 0>, - <ST_MORPHO_R_29 0 &gpiob 5 0>, - <ST_MORPHO_R_30 0 &gpiob 13 0>, - <ST_MORPHO_R_31 0 &gpiob 3 0>, - <ST_MORPHO_R_33 0 &gpioa 10 0>, - <ST_MORPHO_R_34 0 &gpioc 4 0>, - <ST_MORPHO_R_35 0 &gpioa 2 0>, - <ST_MORPHO_R_37 0 &gpioa 3 0>; - }; -}; diff --git a/005_bootloader_usage/boards/barth/stg_800/stg_800.dts b/005_bootloader_usage/boards/barth/stg_800/stg_800.dts deleted file mode 100644 index 6f1c7b6..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/stg_800.dts +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2017 Bobby Noelte - * - * SPDX-License-Identifier: Apache-2.0 - */ - - /dts-v1/; - #include "stm32f091cc.dtsi" - #include <st/f0/stm32f091c(b-c)tx-pinctrl.dtsi> - #include "arduino_r3_connector.dtsi" - #include "st_morpho_connector.dtsi" - #include <zephyr/dt-bindings/input/input-event-codes.h> - - / { - model = "STMicroelectronics STM32F091RC-NUCLEO board"; - compatible = "barth,stg_800"; - - chosen { - zephyr,shell-uart = &usart2; - zephyr,sram = &sram0; - zephyr,flash = &flash0; - zephyr,canbus = &can1; - }; - - leds: leds { - status = "okay"; - compatible = "gpio-leds"; - green_led: green_led { - status = "okay"; - gpios = <&gpioa 8 GPIO_ACTIVE_HIGH>; - label = "User LD"; - }; - }; - - gpio_keys { - status = "okay"; - compatible = "gpio-keys"; - mcuboot_button0: button_0 { - status = "okay"; - label = "SW1"; - gpios = <&gpioa 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; //In 4 - zephyr,code = <INPUT_KEY_0>; - }; - - - }; - - buttons { - status = "okay"; - compatible = "gpio-keys"; - button1: button_1 { - status = "okay"; - gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>; - }; - }; - - pwmleds: pwmleds { - compatible = "pwm-leds"; - /* NOTE: disabled by default, PWM2 conflicts with SPI1 */ - status = "disabled"; - - green_pwm_led: green_pwm_led { - pwms = <&pwm2 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; - }; - }; - - aliases { - led0 = &green_led; - sw0 = &mcuboot_button0; - pwm-led0 = &green_pwm_led; - watchdog0 = &iwdg; - die-temp0 = &die_temp; - volt-sensor0 = &vref; - volt-sensor1 = &vbat; - mcuboot-button0 = &mcuboot_button0; - }; - }; - - - - &clk_hsi { - status = "okay"; - - }; - &clk_lsi { - status = "okay"; - }; - - &pll { - prediv = <1>; - mul = <6>; - clocks = <&clk_hsi>; - status = "okay"; - }; - - &rcc { - clocks = <&pll>; - clock-frequency = <DT_FREQ_M(48)>; - ahb-prescaler = <1>; - apb1-prescaler = <1>; - }; - - &usart1 { - pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; - pinctrl-names = "default"; - current-speed = <115200>; - status = "okay"; - - }; - - &usart2 { - pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>; - pinctrl-names = "default"; - current-speed = <115200>; - status = "okay"; - }; - - &i2c1 { - pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>; - pinctrl-names = "default"; - status = "okay"; - clock-frequency = <I2C_BITRATE_FAST>; - }; - - &i2c2 { - /* Pin conflict with can1. Enable only with can1 disabled. */ - pinctrl-0 = <&i2c2_scl_pa11 &i2c2_sda_pa12>; - pinctrl-names = "default"; - status = "disabled"; - clock-frequency = <I2C_BITRATE_FAST>; - }; - - &can1 { - pinctrl-0 = <&can_rx_pa11 &can_tx_pa12>; - pinctrl-names = "default"; - status = "okay"; - }; - - &spi1 { - pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>; - pinctrl-names = "default"; - status = "okay"; - }; - - &spi2 { - pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>; - pinctrl-names = "default"; - status = "okay"; - }; - - &iwdg { - status = "okay"; - }; - - &rtc { - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>, - <&rcc STM32_SRC_LSI RTC_SEL(2)>; - status = "okay"; - }; - - - - &adc1 { - pinctrl-0 = <&adc_in0_pa0>; - pinctrl-names = "default"; - st,adc-clock-source = <SYNC>; - st,adc-prescaler = <4>; - status = "okay"; - }; - - &die_temp { - status = "okay"; - }; - - &dac1 { - status = "okay"; - pinctrl-0 = <&dac_out1_pa4>; - pinctrl-names = "default"; - }; - - &dma1 { - status = "okay"; - }; - - &timers2 { - st,prescaler = <10000>; - status = "okay"; - - pwm2: pwm { - /* NOTE: disabled by default, PWM2 conflicts with SPI1 */ - pinctrl-0 = <&tim2_ch1_pa5>; - pinctrl-names = "default"; - }; - }; - - &vref { - status = "okay"; - }; - - &vbat { - status = "okay"; - }; - - &flash0 { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; /* 64 KB */ - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00018000>; /* 96 KB */ - }; - - slot1_partition: partition@20000 { - label = "image-1"; - reg = <0x00020000 0x00018000>; /* 96 KB */ - }; - - storage_partition: partition@38000 { - label = "storage"; - reg = <0x00038000 0x00008000>; /* 32 KB */ - }; - }; -}; - - - /{ - chosen { - zephyr,code-partition = &slot0_partition; - zephyr,console = &usart1; - - }; - }; - - - \ No newline at end of file diff --git a/005_bootloader_usage/boards/barth/stg_800/stg_800.yaml b/005_bootloader_usage/boards/barth/stg_800/stg_800.yaml deleted file mode 100644 index e0f1e84..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/stg_800.yaml +++ /dev/null @@ -1,31 +0,0 @@ -identifier: stg_800 -name: STG-800 -type: mcu -arch: arm -toolchain: - - zephyr - - gnuarmemb - - xtools -ram: 32 -flash: 256 -supported: - - arduino_gpio - - arduino_i2c - - arduino_spi - - gpio - - i2c - - nvs - - spi - - counter - - watchdog - - adc - - dac - - dma - - pwm - - can - - rtc -testing: - ignore_tags: - - net - - bluetooth -vendor: st diff --git a/005_bootloader_usage/boards/barth/stg_800/stg_800_defconfig b/005_bootloader_usage/boards/barth/stg_800/stg_800_defconfig deleted file mode 100644 index 06e8a32..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/stg_800_defconfig +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -# Serial Drivers -CONFIG_SERIAL=y -CONFIG_UART_INTERRUPT_DRIVEN=y -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -# GPIO Controller -CONFIG_GPIO=y - -# Enable Clocks -CONFIG_CLOCK_CONTROL=y - -# enable pin controller -CONFIG_PINCTRL=y diff --git a/005_bootloader_usage/boards/barth/stg_800/stm32f091cc.dtsi b/005_bootloader_usage/boards/barth/stg_800/stm32f091cc.dtsi deleted file mode 100644 index a840f07..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/stm32f091cc.dtsi +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2018 Linaro Limited - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include <mem.h> -#include <st/f0/stm32f091.dtsi> - -/ { - sram0: memory@20000000 { - reg = <0x20000000 DT_SIZE_K(32)>; - }; - - soc { - flash-controller@40022000 { - flash0: flash@8000000 { - reg = <0x08000000 DT_SIZE_K(256)>; - }; - }; - }; -}; diff --git a/005_bootloader_usage/boards/barth/stg_800/support/openocd.cfg b/005_bootloader_usage/boards/barth/stg_800/support/openocd.cfg deleted file mode 100644 index 66b400a..0000000 --- a/005_bootloader_usage/boards/barth/stg_800/support/openocd.cfg +++ /dev/null @@ -1,12 +0,0 @@ -source [find board/st_nucleo_f0.cfg] - -$_TARGETNAME configure -event gdb-attach { - echo "Debugger attaching: halting execution" - reset halt - gdb_breakpoint_override hard -} - -$_TARGETNAME configure -event gdb-detach { - echo "Debugger detaching: resuming execution" - resume -} diff --git a/005_bootloader_usage/mcuboot.conf b/005_bootloader_usage/mcuboot.conf new file mode 100644 index 0000000..e69de29 diff --git a/005_bootloader_usage/prj.conf b/005_bootloader_usage/prj.conf index ba1d2e1..d3b0a92 100644 --- a/005_bootloader_usage/prj.conf +++ b/005_bootloader_usage/prj.conf @@ -9,4 +9,15 @@ CONFIG_PRINTK=y CONFIG_LOG_PRINTK=y CONFIG_BOOTLOADER_MCUBOOT=y -CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="bootloader/mcuboot/root-rsa-2048.pem" + +CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="bootloader/mcuboot/mykey-ecdsa-p256.pem" +#CONFIG_MCUBOOT_ENCRYPTION_KEY_FILE="bootloader/mcuboot/mykey-ecdsa-p256.pem" + + + + + + + +# Add other necessary configurations +# ... diff --git a/006_bootloader_f407disco/CMakeLists.txt b/006_bootloader_f407disco/CMakeLists.txt new file mode 100644 index 0000000..ec2a737 --- /dev/null +++ b/006_bootloader_f407disco/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.22) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(BOARD stm32f4_disco ) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(006_bootloader_f407disco) + +target_sources(app PRIVATE src/main.c) + + diff --git a/006_bootloader_f407disco/boards/stm32f4_disco.overlay b/006_bootloader_f407disco/boards/stm32f4_disco.overlay new file mode 100644 index 0000000..ee37e97 --- /dev/null +++ b/006_bootloader_f407disco/boards/stm32f4_disco.overlay @@ -0,0 +1,45 @@ + +/ { + leds { + status = "okay"; + compatible = "gpio-leds"; + blinking_led: blinking_led { //yorum + status = "okay"; + gpios = <&gpiod 13 GPIO_ACTIVE_HIGH>; // GPIO_ACTIVE_HIGH (or GPIO_ACTIVE_LOW): Specifies the active logic level of a GPIO pin. + }; + }; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x00010000>; /* 64 KB */ + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00018000>; /* 96 KB */ + }; + + slot1_partition: partition@20000 { + label = "image-1"; + reg = <0x00020000 0x00018000>; /* 96 KB */ + }; + + storage_partition: partition@38000 { + label = "storage"; + reg = <0x00038000 0x00008000>; /* 32 KB */ + }; + }; +}; + +/ { + chosen { + zephyr,code-partition = &slot0_partition; + }; +}; diff --git a/006_bootloader_f407disco/prj.conf b/006_bootloader_f407disco/prj.conf new file mode 100644 index 0000000..7d7f9da --- /dev/null +++ b/006_bootloader_f407disco/prj.conf @@ -0,0 +1,14 @@ +CONFIG_MAIN_THREAD_PRIORITY=0 +CONFIG_MAIN_STACK_SIZE=1024 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024 +CONFIG_LOG=y +CONFIG_SERIAL=y +CONFIG_GPIO=y + +CONFIG_PRINTK=y +CONFIG_LOG_PRINTK=y + +CONFIG_BOOTLOADER_MCUBOOT=y + +CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="bootloader/mcuboot/mykey-ecdsa-p256.pem" +CONFIG_MCUBOOT_ENCRYPTION_KEY_FILE="bootloader/mcuboot/mykey-ecdsa-p256.pem" diff --git a/006_bootloader_f407disco/src/main.c b/006_bootloader_f407disco/src/main.c new file mode 100644 index 0000000..0db86a5 --- /dev/null +++ b/006_bootloader_f407disco/src/main.c @@ -0,0 +1,47 @@ +#include <stdio.h> +#include <zephyr/kernel.h> +#include <zephyr/drivers/gpio.h> +#include <zephyr/devicetree.h> + +#define GPIO_PIN 13 +#define LED0_NODE DT_NODELABEL(blinking_led) +int counter = 30; +//#if DT_NODE_HAS_STATUS(MY_SERIAL, okay) +static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); +//#else +//#error "Node is disabled" +//#endif + +void increment_counter(void); +int main(void){ + if (!device_is_ready(led.port)) { + //printk("GPIO device %s is not ready\n", gpio_ct_dev->name); + return 1; + } + int gpio_conf; + //gpio_conf = gpio_pin_configure(led.port,led.pin, led.dt_flags); + gpio_conf = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE); + //GPIO_OUTPUT_ACTIVE (or GPIO_OUTPUT_INACTIVE): Configures a GPIO pin + // as an output and sets its initial state to the active (or inactive) state. + counter = counter + 1; + + int pin_set = 0; + while(true){ + increment_counter(); + //pin_set = gpio_pin_set_raw(led.port, led.pin, 1); + //pin_set = gpio_pin_set_dt(&led, 1); + pin_set = gpio_pin_toggle_dt(&led); + k_msleep(1000); // Sleep for 1 second + //pin_set = gpio_pin_set_dt(&led, 0); + //k_msleep(1000); // Sleep for 1 second + } + return 0; +} +void increment_counter(){ + counter = counter + 1; +} + + + + + diff --git a/006_bootloader_f407disco/src/main_old.c b/006_bootloader_f407disco/src/main_old.c new file mode 100644 index 0000000..0acbe15 --- /dev/null +++ b/006_bootloader_f407disco/src/main_old.c @@ -0,0 +1,37 @@ +#include <zephyr/kernel.h> +#include <zephyr/drivers/gpio.h> + +#define GPIO_PIN 13 +int counter = 30; +static const struct device *gpio_ct_dev = DEVICE_DT_GET(DT_NODELABEL(gpiod)); +void increment_counter(void); +int main(void){ + if (!device_is_ready(gpio_ct_dev)) { + //printk("GPIO device %s is not ready\n", gpio_ct_dev->name); + return 1; + } + int gpio_conf; + gpio_conf = gpio_pin_configure(gpio_ct_dev,GPIO_PIN, GPIO_OUTPUT_ACTIVE); + + counter = counter + 1; + + int pin_set = 0; + while(true){ + increment_counter(); + pin_set = gpio_pin_set_raw(gpio_ct_dev, GPIO_PIN, 1); + //printk("Hello World\n"); + k_msleep(1000); // Sleep for 1 second + pin_set = gpio_pin_set_raw(gpio_ct_dev, GPIO_PIN, 0); + + k_msleep(1000); // Sleep for 1 second + } + return 0; +} +void increment_counter(){ + counter = counter + 1; +} + + + + +