源码默认支持STM32F107芯片
STM32 HAL库测试:zubax_gnssbootloaderzubax_chibioschibiostesthalSTM32
STM32 ChibiOS/RT系统测试:zubax_gnssbootloaderzubax_chibioschibiosdemosSTM32
拷贝STM32F407默认配置文件
这三个文件是ChibiOS/RT系统主要的配置文件
源:zubax_gnssbootloaderzubax_chibioschibiosdemosSTM32RT-STM32F407-DISCOVERY
目的:zubax_gnssbootloadersrcos_config
# vi mcuconf.h
#define STM32_SPI_USE_SPI3 TRUE //使用SPI3
#define STM32_USB_USE_OTG1 TRUE //使用USB1
#define STM32_SERIAL_USE_USART1 TRUE //使用UART1
# vi halconf.h
#define HAL_USE_SPI TRUE //使能SPI
#define HAL_USE_SERIAL_USB TRUE //使能SERIAL_USB
#define HAL_USE_USB TRUE //使能USB
# vi chconf.h
#define CH_DBG_ENABLE_STACK_CHECK TRUE //DEBUG使用
拷贝board.h
源:zubax_gnssbootloaderzubax_chibioschibiososhalboardsST_STM32F4_DISCOVERY
目的:zubax_gnssbootloadersrcos_config
# vi board.h
#define GPIO_PORT_LED_CAN1 GPIOF //用户程序CAN状态灯定义
#define GPIO_PIN_LED_CAN1 9
#define GPIO_PORT_LED_CAN2 GPIOF
#define GPIO_PIN_LED_CAN2 10
#define DEBUG_BUILD 1 //DEBUG开关
修改Makefile
# vi Makefile
SERIAL_CLI_PORT_NUMBER = 3 //UART调试口选择。-DSTDOUT_SD=SD$(SERIAL_CLI_PORT_NUMBER)
include zubax_chibios/rules_stm32f446.mk
firmware中还需配置
pal_lld.h:(zubax_gnssfirmwarezubax_chibioschibiososhalportsSTM32LLDGPIOv2pal_lld.h)
因为F407使用的是GPIOv2
#define pal_lld_setport(port, bits) (((ioportid_t)(port))->BSRR.H.set = (uint16_t)(bits)) //添加强制类型转换,不然编译报错
#define PAL_MODE_STM32_ALTERNATE_PUSHPULL 16 //GPIOv2中没有定义
#define PAL_MODE_STM32_ALTERNATE_OPENDRAIN 17
air_sensor.cpp:zubax_gnssfirmwaresrcair_sensor.cpp
driver_(&SPID3, (GPIO_TypeDef*)GPIO_PORT_BAROMETER_CHIP_SELECT, GPIO_PIN_BAROMETER_CHIP_SELECT) //同上
配置board.cpp
board.cpp:zubax_gnssfirmwaresrcboard
const PALConfig pal_default_config = {
#if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
#endif
#if STM32_HAS_GPIOB
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
#endif
#if STM32_HAS_GPIOC
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
#endif
#if STM32_HAS_GPIOD
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
#endif
#if STM32_HAS_GPIOE
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
#endif
#if STM32_HAS_GPIOF
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
#endif
#if STM32_HAS_GPIOG
{VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
#endif
#if STM32_HAS_GPIOH
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
#endif
#if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
#endif
};
编译
# git submodule update --init --recursive //子模块更新
# cd firmware
# make binaries RELEASE=1
# ls build/ -l
-rwxrwxr-x 1 thomas thomas 5257152 Nov 4 18:59 compound.elf
-rw-rw-r-- 1 thomas thomas 213040 Nov 4 18:59 com.zubax.gnss-2.2-4.0.16f8c7b.application.bin
-rw-rw-r-- 1 thomas thomas 278569 Nov 4 18:59 com.zubax.gnss-2.2-4.0.16f8c7b.compound.bin //包含bootloader和application
-rw-rw-r-- 1 thomas thomas 2560450 Nov 4 18:59 com.zubax.gnss.map
上一篇:ChibiOS/RT移植到STM32F407
下一篇:STM32 IAP 升级功能
推荐阅读最新更新时间:2024-11-13 10:45
设计资源 培训 开发板 精华推荐
- L7809C 分体式稳压器的典型应用 (± 15 V - 1 A)
- 使用 TC7106 ADC 实现 200 mV 满量程、每秒 3 个读数的典型应用
- NCV48220D50GEVB:具有电荷泵升压转换器评估板的 150 mA 极低静态电流 LDO 稳压器
- ADM1186-2ARQZ 四路电压监控的典型应用电路
- LT1172CN8、-28/1.25A 负升压稳压器的典型应用
- USB-TTL-FT232
- LT8330EDDB 4V 至 16V 输入、-5V 反相转换器的典型应用电路
- 使用 ROHM Semiconductor 的 BU4813 的参考设计
- [V2_Released]IP6538-AC型
- KAZZO FC红白机游戏卡dump烧录器