Add support for STM32G474: Add B-G474E-DPOW1 board
Add support for the STM32G474 family of microcontrollers and the B-G474E-DPOW1 Discovery Board, which features a STM32G474RET6. This is a major pull request as it adds support for an entirely new family of STM32. This support is implemented in arch/arm/src/stm32 and shares implementation with other STM32 families supported by that code, such as the 'L15xx, 'F10xx, 'F20xx, 'F3xxx, and 'F4xxx. boards/Kconfig: * Make NuttX recognize the existence of b-g474e-dpow1, the B-G474E-DPOW1 Discovery Board. boards/arm/stm32/b-g474e-dpow1/Kconfig: boards/arm/stm32/b-g474e-dpow1/README.txt: boards/arm/stm32/b-g474e-dpow1/configs/nsh/defconfig: boards/arm/stm32/b-g474e-dpow1/include/board.h: boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs: boards/arm/stm32/b-g474e-dpow1/scripts/ld.script: boards/arm/stm32/b-g474e-dpow1/src/.gitignore: boards/arm/stm32/b-g474e-dpow1/src/Make.defs: boards/arm/stm32/b-g474e-dpow1/src/b-g474e-dpow1.h: boards/arm/stm32/b-g474e-dpow1/src/stm32_appinit.c: boards/arm/stm32/b-g474e-dpow1/src/stm32_autoleds.c: boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c: boards/arm/stm32/b-g474e-dpow1/src/stm32_userleds.c: * Add minimal support for the B-G474E-DPOW1 Discovery Board. The board boots successfully through to the NSH prompt. NSH runs and is responsive. With big thanks for detailed code review and suggestions: David Sidrane (davids5) Mateusz Szafoni (raiden00) Abdelatif Guettouche (Ouss4)
This commit is contained in:
parent
168a4cafc6
commit
bb10e0fc25
@ -1693,6 +1693,16 @@ config ARCH_BOARD_STM32F746_WS
|
|||||||
---help---
|
---help---
|
||||||
Waveshare STM32F746 development board featuring the STM32F746IG MCU.
|
Waveshare STM32F746 development board featuring the STM32F746IG MCU.
|
||||||
|
|
||||||
|
config ARCH_BOARD_B_G474E_DPOW1
|
||||||
|
bool "ST Micro B-G474E-DPOW1 Discovery Kit"
|
||||||
|
depends on ARCH_CHIP_STM32G474R
|
||||||
|
select ARCH_HAVE_LEDS
|
||||||
|
select ARCH_HAVE_BUTTONS
|
||||||
|
---help---
|
||||||
|
ST Micro B-G474E-DPOW1 Discovery Kit, based on the STM32G474RET6
|
||||||
|
MCU, a Cortex-M4 with FPU, 170 MHz, 128 KB SRAM, 512 KB code.
|
||||||
|
See boards/arm/stm32/b-g474e-dpow1/README.txt.
|
||||||
|
|
||||||
config ARCH_BOARD_B_L072Z_LRWAN1
|
config ARCH_BOARD_B_L072Z_LRWAN1
|
||||||
bool "B-L072Z-LRWAN1"
|
bool "B-L072Z-LRWAN1"
|
||||||
depends on ARCH_CHIP_STM32L072CZ
|
depends on ARCH_CHIP_STM32L072CZ
|
||||||
@ -2247,6 +2257,7 @@ config ARCH_BOARD
|
|||||||
default "stm32f769i-disco" if ARCH_BOARD_STM32F769I_DISCO
|
default "stm32f769i-disco" if ARCH_BOARD_STM32F769I_DISCO
|
||||||
default "stm32h747i-disco" if ARCH_BOARD_STM32H747I_DISCO
|
default "stm32h747i-disco" if ARCH_BOARD_STM32H747I_DISCO
|
||||||
default "stm32f746-ws" if ARCH_BOARD_STM32F746_WS
|
default "stm32f746-ws" if ARCH_BOARD_STM32F746_WS
|
||||||
|
default "b-g474e-dpow1" if ARCH_BOARD_B_G474E_DPOW1
|
||||||
default "b-l072z-lrwan1" if ARCH_BOARD_B_L072Z_LRWAN1
|
default "b-l072z-lrwan1" if ARCH_BOARD_B_L072Z_LRWAN1
|
||||||
default "b-l475e-iot01a" if ARCH_BOARD_B_L475E_IOT01A
|
default "b-l475e-iot01a" if ARCH_BOARD_B_L475E_IOT01A
|
||||||
default "stm32l476vg-disco" if ARCH_BOARD_STM32L476VG_DISCO
|
default "stm32l476vg-disco" if ARCH_BOARD_STM32L476VG_DISCO
|
||||||
@ -2553,6 +2564,9 @@ endif
|
|||||||
if ARCH_BOARD_SAMV71_XULT
|
if ARCH_BOARD_SAMV71_XULT
|
||||||
source "boards/arm/samv7/samv71-xult/Kconfig"
|
source "boards/arm/samv7/samv71-xult/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_B_G474E_DPOW1
|
||||||
|
source "boards/arm/stm32/b-g474e-dpow1/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_B_L072Z_LRWAN1
|
if ARCH_BOARD_B_L072Z_LRWAN1
|
||||||
source "boards/arm/stm32f0l0g0/b-l072z-lrwan1/Kconfig"
|
source "boards/arm/stm32f0l0g0/b-l072z-lrwan1/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
21
boards/arm/stm32/b-g474e-dpow1/Kconfig
Normal file
21
boards/arm/stm32/b-g474e-dpow1/Kconfig
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_BOARD_B_G474E_DPOW1
|
||||||
|
|
||||||
|
#config SOME_CONFIG_INT
|
||||||
|
# int "Description"
|
||||||
|
# default 1
|
||||||
|
# depends on FEATURE_X
|
||||||
|
#
|
||||||
|
#config SOME_CONFIG_BOOL
|
||||||
|
# bool "Description"
|
||||||
|
# default n if !FEATURE_X
|
||||||
|
# default y if FEATURE_X
|
||||||
|
# depends on FEATURE_Y
|
||||||
|
# ---help---
|
||||||
|
# Help text goes here.
|
||||||
|
|
||||||
|
endif # ARCH_BOARD_B_G474E_DPOW1
|
122
boards/arm/stm32/b-g474e-dpow1/README.txt
Normal file
122
boards/arm/stm32/b-g474e-dpow1/README.txt
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
README
|
||||||
|
======
|
||||||
|
|
||||||
|
This is the README file for a port of NuttX to the ST Micro B-G474E-DPOW1
|
||||||
|
Discovery kit with STM32G474RE MCU. For more information about this board,
|
||||||
|
see:
|
||||||
|
|
||||||
|
https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/b-g474e-dpow1.html
|
||||||
|
|
||||||
|
|
||||||
|
Contents
|
||||||
|
========
|
||||||
|
|
||||||
|
- Status
|
||||||
|
- Development Environment
|
||||||
|
- Toolchains
|
||||||
|
- Debugging
|
||||||
|
- Hardware
|
||||||
|
- MCU Clocking
|
||||||
|
- GPIOs
|
||||||
|
- Buttons
|
||||||
|
- LEDs
|
||||||
|
- RGB Power LED
|
||||||
|
- Serial Consoles
|
||||||
|
- Configurations
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
======
|
||||||
|
|
||||||
|
This port boots NuttX through to a functional NSH prompt.
|
||||||
|
|
||||||
|
|
||||||
|
Development Environment
|
||||||
|
=======================
|
||||||
|
|
||||||
|
Toolchains
|
||||||
|
----------
|
||||||
|
An appropriate ARM toolchain is needed, such as the one built with the
|
||||||
|
customized NuttX buildroot or the ready-made GNU Tools for Arm Embedded
|
||||||
|
Processors.
|
||||||
|
|
||||||
|
|
||||||
|
Debugging
|
||||||
|
---------
|
||||||
|
The board incorporates a STLINK-V3E programmer/debugger accessible via the
|
||||||
|
Micro-USB Type B connector.
|
||||||
|
|
||||||
|
To debug with OpenOCD and arm-nuttx-eabi-gdb:
|
||||||
|
|
||||||
|
* Use 'make menuconfig' to set CONFIG_DEBUG_SYMBOLS and CONFIG_DEBUG_NOOPT.
|
||||||
|
To see debug output, e.g., the "ABCDE" printed in __start(), also set
|
||||||
|
CONFIG_DEBUG_FEATURES.
|
||||||
|
|
||||||
|
* Build NuttX.
|
||||||
|
|
||||||
|
* Flash the code using:
|
||||||
|
$ openocd -f interface/stlink.cfg -f target/stm32g4x.cfg -c init \
|
||||||
|
-c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"
|
||||||
|
|
||||||
|
* Start GDB with:
|
||||||
|
$ arm-nuttx-eabi-gdb -tui nuttx
|
||||||
|
|
||||||
|
* In GDB:
|
||||||
|
(gdb) target remote localhost:3333
|
||||||
|
(gdb) monitor reset halt
|
||||||
|
(gdb) load
|
||||||
|
|
||||||
|
|
||||||
|
Hardware
|
||||||
|
========
|
||||||
|
|
||||||
|
MCU Clocking
|
||||||
|
------------
|
||||||
|
By default, the MCU on this board is clocked from the MCU's internal HSI
|
||||||
|
clock, and only this option is supported by software at this time.
|
||||||
|
|
||||||
|
If software support is added for it, the MCU could be clocked from the
|
||||||
|
following other sources: a 24 MHz oscillator on X2, MCO from STLINK-V3E, or
|
||||||
|
external clock from connector CN9, pin 26.
|
||||||
|
|
||||||
|
|
||||||
|
GPIOs
|
||||||
|
-----
|
||||||
|
|
||||||
|
|
||||||
|
Buttons
|
||||||
|
-------
|
||||||
|
The board has 5 user buttons in the form of a 4-direction "joystick" with a
|
||||||
|
selection button (pressing down on the "joystick").
|
||||||
|
|
||||||
|
|
||||||
|
LEDs
|
||||||
|
----
|
||||||
|
The board has 4 user LEDs.
|
||||||
|
|
||||||
|
|
||||||
|
RGB Power LED
|
||||||
|
-------------
|
||||||
|
The board has a super bright RGB power LED.
|
||||||
|
|
||||||
|
Caution: For eye safety, ensure that the power LED is covered by the
|
||||||
|
diffuser that comes installed over it.
|
||||||
|
|
||||||
|
|
||||||
|
Serial Consoles
|
||||||
|
===============
|
||||||
|
|
||||||
|
The MCU's USART3 is connected to the on-board STLINK-V3E and exposed to
|
||||||
|
the PC as a Virtual COM Port over the same Micro-USB Type B connection used
|
||||||
|
for programming/debugging.
|
||||||
|
|
||||||
|
On Debian Linux, this shows up as /dev/ttyACM0. Other operating systems may
|
||||||
|
differ.
|
||||||
|
|
||||||
|
|
||||||
|
Configurations
|
||||||
|
==============
|
||||||
|
|
||||||
|
nsh
|
||||||
|
---
|
||||||
|
|
48
boards/arm/stm32/b-g474e-dpow1/configs/nsh/defconfig
Normal file
48
boards/arm/stm32/b-g474e-dpow1/configs/nsh/defconfig
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_ARCH_LEDS is not set
|
||||||
|
# CONFIG_DISABLE_OS_API is not set
|
||||||
|
# CONFIG_NSH_DISABLE_PRINTF is not set
|
||||||
|
CONFIG_ARCH="arm"
|
||||||
|
CONFIG_ARCH_BOARD="b-g474e-dpow1"
|
||||||
|
CONFIG_ARCH_BOARD_B_G474E_DPOW1=y
|
||||||
|
CONFIG_ARCH_BUTTONS=y
|
||||||
|
CONFIG_ARCH_CHIP="stm32"
|
||||||
|
CONFIG_ARCH_CHIP_STM32=y
|
||||||
|
CONFIG_ARCH_CHIP_STM32G474R=y
|
||||||
|
CONFIG_ARCH_HIPRI_INTERRUPT=y
|
||||||
|
CONFIG_ARCH_RAMVECTORS=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARMV7M_USEBASEPRI=y
|
||||||
|
CONFIG_ARMV7M_LAZYFPU=y
|
||||||
|
CONFIG_ARMV7M_LIBM=y
|
||||||
|
CONFIG_ARMV7M_MEMCPY=y
|
||||||
|
CONFIG_DEBUG_FEATURES=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_LIBC_FLOATINGPOINT=y
|
||||||
|
CONFIG_LIBM=y
|
||||||
|
CONFIG_MAX_TASKS=16
|
||||||
|
CONFIG_NFILE_DESCRIPTORS=8
|
||||||
|
CONFIG_NFILE_STREAMS=8
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_LINELEN=64
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PRIORITY_INHERITANCE=y
|
||||||
|
CONFIG_RAM_SIZE=98304
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_SCHED_HPWORK=y
|
||||||
|
CONFIG_SCHED_LPWORK=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STM32_USART3=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_USART3_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERLED=y
|
||||||
|
CONFIG_USERLED_LOWER=y
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
191
boards/arm/stm32/b-g474e-dpow1/include/board.h
Normal file
191
boards/arm/stm32/b-g474e-dpow1/include/board.h
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/b-g474e-dpow1/include/board.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_ARM_STM32_B_G474E_DPOW1_INCLUDE_BOARD_H
|
||||||
|
#define __BOARDS_ARM_STM32_B_G474E_DPOW1_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking *****************************************************************/
|
||||||
|
|
||||||
|
#undef STM32_BOARD_XTAL /* Not installed by default */
|
||||||
|
|
||||||
|
#define STM32_HSI_FREQUENCY 16000000ul /* 16MHz */
|
||||||
|
#define STM32_LSI_FREQUENCY 32000 /* 32kHz */
|
||||||
|
#undef STM32_HSE_FREQUENCY /* Not installed by default */
|
||||||
|
#undef STM32_LSE_FREQUENCY /* Not available on this board */
|
||||||
|
|
||||||
|
/* Main PLL Configuration.
|
||||||
|
*
|
||||||
|
* PLL source is HSI = 16MHz
|
||||||
|
* PLLN = 85, PLLM = 4, PLLP = 10, PLLQ = 2, PLLR = 2
|
||||||
|
*
|
||||||
|
* f(VCO Clock) = f(PLL Clock Input) x (PLLN / PLLM)
|
||||||
|
* f(PLL_P) = f(VCO Clock) / PLLP
|
||||||
|
* f(PLL_Q) = f(VCO Clock) / PLLQ
|
||||||
|
* f(PLL_R) = f(VCO Clock) / PLLR
|
||||||
|
*
|
||||||
|
* Where:
|
||||||
|
* 8 <= PLLN <= 127
|
||||||
|
* 1 <= PLLM <= 16
|
||||||
|
* PLLP = 2 through 31
|
||||||
|
* PLLQ = 2, 4, 6, or 8
|
||||||
|
* PLLR = 2, 4, 6, or 8
|
||||||
|
*
|
||||||
|
* Do not exceed 170MHz on f(PLL_P), f(PLL_Q), or f(PLL_R).
|
||||||
|
* 64MHz <= f(VCO Clock) <= 344MHz.
|
||||||
|
*
|
||||||
|
* Given the above:
|
||||||
|
*
|
||||||
|
* f(VCO Clock) = HSI x PLLN / PLLM
|
||||||
|
* = 16MHz x 85 / 4
|
||||||
|
* = 340MHz
|
||||||
|
*
|
||||||
|
* PLLPCLK = f(VCO Clock) / PLLP
|
||||||
|
* = 340MHz / 10
|
||||||
|
* = 34MHz
|
||||||
|
* (May be used for ADC)
|
||||||
|
*
|
||||||
|
* PLLQCLK = f(VCO Clock) / PLLQ
|
||||||
|
* = 340MHz / 2
|
||||||
|
* = 170MHz
|
||||||
|
* (May be used for QUADSPI, FDCAN, SAI1, I2S3. If set to
|
||||||
|
* 48MHz, may be used for USB, RNG.)
|
||||||
|
*
|
||||||
|
* PLLRCLK = f(VCO Clock) / PLLR
|
||||||
|
* = 340MHz / 2
|
||||||
|
* = 170MHz
|
||||||
|
* (May be used for SYSCLK and most peripherals.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STM32_PLLCFGR_PLLSRC RCC_PLLCFGR_PLLSRC_HSI
|
||||||
|
#define STM32_PLLCFGR_PLLCFG (RCC_PLLCFGR_PLLPEN | \
|
||||||
|
RCC_PLLCFGR_PLLQEN | \
|
||||||
|
RCC_PLLCFGR_PLLREN)
|
||||||
|
|
||||||
|
#define STM32_PLLCFGR_PLLN RCC_PLLCFGR_PLLN(85)
|
||||||
|
#define STM32_PLLCFGR_PLLM RCC_PLLCFGR_PLLM(4)
|
||||||
|
#define STM32_PLLCFGR_PLLP RCC_PLLCFGR_PLLPDIV(10)
|
||||||
|
#define STM32_PLLCFGR_PLLQ RCC_PLLCFGR_PLLQ_2
|
||||||
|
#define STM32_PLLCFGR_PLLR RCC_PLLCFGR_PLLR_2
|
||||||
|
|
||||||
|
#define STM32_VCO_FREQUENCY ((STM32_HSI_FREQUENCY / 4) * 85)
|
||||||
|
#define STM32_PLLP_FREQUENCY (STM32_VCO_FREQUENCY / 10)
|
||||||
|
#define STM32_PLLQ_FREQUENCY (STM32_VCO_FREQUENCY / 2)
|
||||||
|
#define STM32_PLLR_FREQUENCY (STM32_VCO_FREQUENCY / 2)
|
||||||
|
|
||||||
|
/* Use the PLL and set the SYSCLK source to be PLLR (170MHz) */
|
||||||
|
|
||||||
|
#define STM32_SYSCLK_SW RCC_CFGR_SW_PLL
|
||||||
|
#define STM32_SYSCLK_SWS RCC_CFGR_SWS_PLL
|
||||||
|
#define STM32_SYSCLK_FREQUENCY STM32_PLLR_FREQUENCY
|
||||||
|
|
||||||
|
/* AHB clock (HCLK) is SYSCLK (170MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK
|
||||||
|
#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
|
||||||
|
#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY
|
||||||
|
|
||||||
|
/* APB1 clock (PCLK1) is HCLK (170MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK
|
||||||
|
#define STM32_PCLK1_FREQUENCY STM32_HCLK_FREQUENCY
|
||||||
|
|
||||||
|
/* APB2 clock (PCLK2) is HCLK (170MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
|
||||||
|
#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
|
||||||
|
/* The B-G474E-DPOW1 Discovery kit has four user LEDs.
|
||||||
|
*
|
||||||
|
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
||||||
|
* any way. The following definitions are used to access individual LEDs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* LED index values for use with board_userled() */
|
||||||
|
|
||||||
|
#define BOARD_LED1 0 /* User LD2 (Blue) */
|
||||||
|
#define BOARD_LED2 1 /* User LD3 (Orange) */
|
||||||
|
#define BOARD_LED3 2 /* User LD4 (Green) */
|
||||||
|
#define BOARD_LED4 3 /* User LD5 (Red)*/
|
||||||
|
#define BOARD_NLEDS 4
|
||||||
|
|
||||||
|
/* LED bits for use with board_userled_all() */
|
||||||
|
|
||||||
|
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||||
|
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||||
|
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
||||||
|
#define BOARD_LED4_BIT (1 << BOARD_LED4)
|
||||||
|
|
||||||
|
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 user LEDs
|
||||||
|
* on the board. The following definitions describe how NuttX controls the
|
||||||
|
* LEDs:
|
||||||
|
*
|
||||||
|
* |--------------------|-------------------------|------------|
|
||||||
|
* | SYMBOL | Meaning | LED states |
|
||||||
|
* |--------------------|-------------------------|------------|
|
||||||
|
* | LED_STARTED | NuttX has been started | 0 0 0 0 |
|
||||||
|
* | LED_HEAPALLOCATE | Heap has been allocated | 0 0 0 0 |
|
||||||
|
* | LED_IRQSENABLED | Interrupts enabled | 0 0 0 0 |
|
||||||
|
* | LED_STACKCREATED | Idle stack created | 1 0 0 0 |
|
||||||
|
* | LED_INIRQ | In an interrupt | No change |
|
||||||
|
* | LED_SIGNAL | In a signal handler | No change |
|
||||||
|
* | LED_ASSERTION | An assertion failed | No change |
|
||||||
|
* | LED_PANIC | The system has crashed | 0 B 0 0 |
|
||||||
|
* | LED_IDLE | STM32 is is sleep mode | Not used |
|
||||||
|
* |--------------------|-------------------------|------------|
|
||||||
|
*
|
||||||
|
* LED states legend:
|
||||||
|
* 0 = off
|
||||||
|
* 1 = on
|
||||||
|
* B = blink
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LED_STARTED 0
|
||||||
|
#define LED_HEAPALLOCATE 0
|
||||||
|
#define LED_IRQSENABLED 0
|
||||||
|
#define LED_STACKCREATED 1
|
||||||
|
#define LED_INIRQ 2
|
||||||
|
#define LED_SIGNAL 2
|
||||||
|
#define LED_ASSERTION 2
|
||||||
|
#define LED_PANIC 3
|
||||||
|
|
||||||
|
/* Button definitions *******************************************************/
|
||||||
|
|
||||||
|
/* Alternate function pin selections ****************************************/
|
||||||
|
|
||||||
|
/* USART3 (ST LINK V3E Virtual Console) */
|
||||||
|
|
||||||
|
#define GPIO_USART3_TX GPIO_USART3_TX_3 /* PC10 */
|
||||||
|
#define GPIO_USART3_RX GPIO_USART3_RX_3 /* PC11 */
|
||||||
|
|
||||||
|
/* Pin Multiplexing Disambiguation ******************************************/
|
||||||
|
|
||||||
|
#endif /* __BOARDS_ARM_STM32_B_G474E_DPOW1_INCLUDE_BOARD_H */
|
93
boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs
Normal file
93
boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/.config
|
||||||
|
include $(TOPDIR)/tools/Config.mk
|
||||||
|
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||||
|
# Windows-native toolchains
|
||||||
|
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||||
|
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||||
|
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
|
||||||
|
else
|
||||||
|
# Linux/Cygwin-native toolchain
|
||||||
|
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||||
|
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||||
|
ARCHSCRIPT = -T$(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/ld.script
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = $(CROSSDEV)gcc
|
||||||
|
CXX = $(CROSSDEV)g++
|
||||||
|
CPP = $(CROSSDEV)gcc -E
|
||||||
|
LD = $(CROSSDEV)ld
|
||||||
|
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||||
|
AR = $(CROSSDEV)ar rcs
|
||||||
|
NM = $(CROSSDEV)nm
|
||||||
|
OBJCOPY = $(CROSSDEV)objcopy
|
||||||
|
OBJDUMP = $(CROSSDEV)objdump
|
||||||
|
|
||||||
|
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||||
|
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
ARCHOPTIMIZATION = -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||||
|
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin -funwind-tables
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -funwind-tables
|
||||||
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||||
|
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||||
|
ARCHDEFINES = -D__NuttX__
|
||||||
|
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||||
|
|
||||||
|
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||||
|
|
||||||
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||||
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||||
|
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Provide map file needed by the "Memory Allocation" view in Eclipse:
|
||||||
|
LDFLAGS += -Map=$(TOPDIR)/NuttX.map --gc-sections
|
||||||
|
|
||||||
|
HOSTCC = gcc
|
||||||
|
HOSTINCLUDES = -I.
|
||||||
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||||
|
|
||||||
|
# Embed absolute path to source file in debug information so that Eclipse
|
||||||
|
# source level debugging won't get confused. See:
|
||||||
|
# https://stackoverflow.com/questions/1275476/gcc-gdb-how-to-embed-absolute-path-to-source-file-in-debug-information
|
||||||
|
CFLAGS += -fdebug-prefix-map=..=$(readlink -f ..)
|
124
boards/arm/stm32/b-g474e-dpow1/scripts/ld.script
Normal file
124
boards/arm/stm32/b-g474e-dpow1/scripts/ld.script
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/b-g474e-dpow1/scripts/ld.script
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* The STM32G474RE has 512 KiB of FLASH beginning at address 0x0800:0000.
|
||||||
|
*
|
||||||
|
* When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
|
||||||
|
* where the code expects to begin execution by jumping to the entry point in
|
||||||
|
* the 0x0800:0000 address range.
|
||||||
|
*
|
||||||
|
* The STM32G474RE has a total of 128 KiB of SRAM in three separate areas:
|
||||||
|
*
|
||||||
|
* 1) 80 KiB SRAM1 mapped at 0x2000:0000 thru 0x2001:3fff.
|
||||||
|
* 2) 16 KiB SRAM2 mapped at 0x2001:4000 thru 0x2001:7fff.
|
||||||
|
*
|
||||||
|
* CCM SRAM (Routine Booster):
|
||||||
|
*
|
||||||
|
* 3) 32 KiB CCM SRAM mapped at 0x1000:0000 thru 0x1000:7fff
|
||||||
|
* but also aliased at at 0x2001:8000 thru 0x2001:ffff to be contiguous
|
||||||
|
* with the SRAM1 and SRAM2.
|
||||||
|
*
|
||||||
|
* Because SRAM1 and SRAM2 are contiguous, they are treated as one region
|
||||||
|
* by this logic.
|
||||||
|
*
|
||||||
|
* CCM SRAM is also contiguous to SRAM1 and SRAM2, however it is excluded
|
||||||
|
* from this linker script, to keep it reserved for special uses in code.
|
||||||
|
* REVISIT: Is this the correct way to handle CCM SRAM?
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
|
||||||
|
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
EXTERN(_vectors)
|
||||||
|
ENTRY(_stext)
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.init_section : ALIGN(4) {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
*(.init_array .init_array.*)
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.ARM.extab : ALIGN(4) {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.ARM.exidx : ALIGN(4) {
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : ALIGN(4) {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > sram AT > flash
|
||||||
|
|
||||||
|
.bss : ALIGN(4) {
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > sram
|
||||||
|
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
2
boards/arm/stm32/b-g474e-dpow1/src/.gitignore
vendored
Normal file
2
boards/arm/stm32/b-g474e-dpow1/src/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/.depend
|
||||||
|
/Make.dep
|
38
boards/arm/stm32/b-g474e-dpow1/src/Make.defs
Normal file
38
boards/arm/stm32/b-g474e-dpow1/src/Make.defs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/arm/stm32/b-g474e-dpow1/src/Makefile
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = stm32_boot.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||||
|
CSRCS += stm32_autoleds.c
|
||||||
|
else
|
||||||
|
CSRCS += stm32_userleds.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||||
|
CSRCS += stm32_appinit.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEPPATH += --dep-path board
|
||||||
|
VPATH += :board
|
||||||
|
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
|
77
boards/arm/stm32/b-g474e-dpow1/src/b-g474e-dpow1.h
Normal file
77
boards/arm/stm32/b-g474e-dpow1/src/b-g474e-dpow1.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/b-g474e-dpow1/src/b-g474e-dpow1.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_ARM_STM32_B_G474E_DPOW1_SRC_B_G474E_DPOW1_H
|
||||||
|
#define __BOARDS_ARM_STM32_B_G474E_DPOW1_SRC_B_G474E_DPOW1_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
|
||||||
|
/* The B-G474E-DPOW1 Discovery kit has four user LEDs:
|
||||||
|
*
|
||||||
|
* | Symbol | PCB | Color |
|
||||||
|
* |------------|-----|--------|
|
||||||
|
* | BOARD_LED1 | LD2 | Blue |
|
||||||
|
* | BOARD_LED2 | LD3 | Orange |
|
||||||
|
* | BOARD_LED3 | LD4 | Green |
|
||||||
|
* | BOARD_LED4 | LD5 | Red |
|
||||||
|
*
|
||||||
|
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LED.
|
||||||
|
*
|
||||||
|
* Pin assignments follow:
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_PUSHPULL | \
|
||||||
|
GPIO_SPEED_5MHz | \
|
||||||
|
GPIO_OUTPUT_CLEAR | \
|
||||||
|
GPIO_PORTA | GPIO_PIN15)
|
||||||
|
#define GPIO_LED2 (GPIO_OUTPUT | GPIO_PUSHPULL | \
|
||||||
|
GPIO_SPEED_5MHz | \
|
||||||
|
GPIO_OUTPUT_CLEAR | \
|
||||||
|
GPIO_PORTB | GPIO_PIN1)
|
||||||
|
#define GPIO_LED3 (GPIO_OUTPUT | GPIO_PUSHPULL | \
|
||||||
|
GPIO_SPEED_5MHz | \
|
||||||
|
GPIO_OUTPUT_CLEAR | \
|
||||||
|
GPIO_PORTB | GPIO_PIN7)
|
||||||
|
#define GPIO_LED4 (GPIO_OUTPUT | GPIO_PUSHPULL | \
|
||||||
|
GPIO_SPEED_5MHz | \
|
||||||
|
GPIO_OUTPUT_CLEAR | \
|
||||||
|
GPIO_PORTB | GPIO_PIN5)
|
||||||
|
|
||||||
|
#define LED_DRIVER_PATH "/dev/userleds"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __BOARDS_ARM_STM32_B_G474E_DPOW1_SRC_B_G474E_DPOW1_H */
|
91
boards/arm/stm32/b-g474e-dpow1/src/stm32_appinit.c
Normal file
91
boards/arm/stm32/b-g474e-dpow1/src/stm32_appinit.c
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/b-g474e-dpow1/src/stm32_appinit.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/leds/userled.h>
|
||||||
|
|
||||||
|
#include "b-g474e-dpow1.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef HAVE_LEDS
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
|
||||||
|
# define HAVE_LEDS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_app_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform application specific initialization. This function is never
|
||||||
|
* called directly from application code, but only indirectly via the
|
||||||
|
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||||
|
* implementation without modification. The argument has no
|
||||||
|
* meaning to NuttX; the meaning of the argument is a contract
|
||||||
|
* between the board-specific initialization logic and the
|
||||||
|
* matching application logic. The value could be such things as a
|
||||||
|
* mode enumeration value, a set of DIP switch settings, a pointer
|
||||||
|
* to configuration data read from a file or serial FLASH, or
|
||||||
|
* whatever you would like to do with it. Every implementation
|
||||||
|
* should accept zero/NULL as a default configuration.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_app_initialize(uintptr_t arg)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
#if defined(HAVE_LEDS)
|
||||||
|
/* Register the LED driver */
|
||||||
|
|
||||||
|
ret = userled_lower_initialize(LED_DRIVER_PATH);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UNUSED(ret);
|
||||||
|
return OK;
|
||||||
|
}
|
109
boards/arm/stm32/b-g474e-dpow1/src/stm32_autoleds.c
Normal file
109
boards/arm/stm32/b-g474e-dpow1/src/stm32_autoleds.c
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/b-g474e-dpow1/src/stm32_autoleds.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "b-g474e-dpow1.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_LEDS)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure LED GPIOs for output */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_LED1);
|
||||||
|
stm32_configgpio(GPIO_LED2);
|
||||||
|
stm32_configgpio(GPIO_LED3);
|
||||||
|
stm32_configgpio(GPIO_LED4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_on
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_on(int led)
|
||||||
|
{
|
||||||
|
switch (led)
|
||||||
|
{
|
||||||
|
case BOARD_LED1:
|
||||||
|
stm32_gpiowrite(GPIO_LED1, true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED2:
|
||||||
|
stm32_gpiowrite(GPIO_LED2, true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED3:
|
||||||
|
stm32_gpiowrite(GPIO_LED3, true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED4:
|
||||||
|
stm32_gpiowrite(GPIO_LED4, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_off
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_off(int led)
|
||||||
|
{
|
||||||
|
switch (led)
|
||||||
|
{
|
||||||
|
case BOARD_LED1:
|
||||||
|
stm32_gpiowrite(GPIO_LED1, false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED2:
|
||||||
|
stm32_gpiowrite(GPIO_LED2, false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED3:
|
||||||
|
stm32_gpiowrite(GPIO_LED3, false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED4:
|
||||||
|
stm32_gpiowrite(GPIO_LED4, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_LEDS */
|
70
boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c
Normal file
70
boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "b-g474e-dpow1.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following entry point. This
|
||||||
|
* entry point is called early in the initialization -- after all memory
|
||||||
|
* has been configured and mapped but before any devices have been
|
||||||
|
* initialized.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void stm32_boardinitialize(void)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ARCH_LEDS)
|
||||||
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
|
board_autoled_initialize();
|
||||||
|
#endif
|
||||||
|
}
|
121
boards/arm/stm32/b-g474e-dpow1/src/stm32_userleds.c
Normal file
121
boards/arm/stm32/b-g474e-dpow1/src/stm32_userleds.c
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/b-g474e-dpow1/src/stm32_userleds.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "b-g474e-dpow1.h"
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ARCH_LEDS)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the user LEDs before use. Note: For this function to be
|
||||||
|
* available to user application logic, CONFIG_ARCH_LEDS must not be
|
||||||
|
* defined.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure LED GPIOs for output */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_LED1);
|
||||||
|
stm32_configgpio(GPIO_LED2);
|
||||||
|
stm32_configgpio(GPIO_LED3);
|
||||||
|
stm32_configgpio(GPIO_LED4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Allow user application logic to control LEDs one at a time. Note: For
|
||||||
|
* this function to be available to user application logic,
|
||||||
|
* CONFIG_ARCH_LEDS must not be defined.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* led: Index to the LED, which may be one of the defines BOARD_LED1,
|
||||||
|
* BOARD_LED2, BOARD_LED3, or BOARD_LED4.
|
||||||
|
* ledon: true to turn the LED on, false to turn it off.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled(int led, bool ledon)
|
||||||
|
{
|
||||||
|
switch (led)
|
||||||
|
{
|
||||||
|
case BOARD_LED1:
|
||||||
|
stm32_gpiowrite(GPIO_LED1, ledon);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED2:
|
||||||
|
stm32_gpiowrite(GPIO_LED2, ledon);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED3:
|
||||||
|
stm32_gpiowrite(GPIO_LED3, ledon);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOARD_LED4:
|
||||||
|
stm32_gpiowrite(GPIO_LED4, ledon);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_all
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Allow user application logic to control all LEDs in one function call.
|
||||||
|
* Note: For this function to be available to user application logic,
|
||||||
|
* CONFIG_ARCH_LEDS must not be defined.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* ledset: Bitmask indicating the new state for all LEDs, where a set bit
|
||||||
|
* indicates LED on and a clear bit indicates LED off. To
|
||||||
|
* construct the bitmask, using a bitwise OR of the defines
|
||||||
|
* BOARD_LED1_BIT, BOARD_LED2_BIT, BOARD_LED3_BIT, and/or
|
||||||
|
* BOARD_LED4_BIT.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_all(uint8_t ledset)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) != 0);
|
||||||
|
stm32_gpiowrite(GPIO_LED2, (ledset & BOARD_LED2_BIT) != 0);
|
||||||
|
stm32_gpiowrite(GPIO_LED3, (ledset & BOARD_LED3_BIT) != 0);
|
||||||
|
stm32_gpiowrite(GPIO_LED4, (ledset & BOARD_LED4_BIT) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !CONFIG_ARCH_LEDS */
|
Loading…
Reference in New Issue
Block a user