Skip to content

Commit

Permalink
Merge pull request #874 from board707/blackpill_F411
Browse files Browse the repository at this point in the history
Add STM32F411CE support and fix #869
  • Loading branch information
stevstrong committed Nov 3, 2023
2 parents dae6e85 + f5188ce commit 9f32103
Show file tree
Hide file tree
Showing 11 changed files with 575 additions and 4 deletions.
61 changes: 58 additions & 3 deletions STM32F4/boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@ discovery_f407.menu.opt.ogstd.build.flags.ldspecs=
##############################################################
blackpill_f401.name=Blackpill STM32F401CCU6

blackpill_f401.upload.tool=stlink_upload
blackpill_f401.upload.protocol=stlink
blackpill_f401.menu.upload_method.STLinkMethod=STLink
blackpill_f401.menu.upload_method.STLinkMethod.upload.protocol=STLink
blackpill_f401.menu.upload_method.STLinkMethod.upload.tool=stlink_upload

blackpill_f401.upload.file_type=bin
blackpill_f401.upload.maximum_size=262144
blackpill_f401.upload.maximum_data_size=65536

blackpill_f401.build.core=maple
blackpill_f401.build.f_cpu=84000000
blackpill_f401.build.extra_flags=-DLED_BUILTIN=PC13 -DCRYSTAL_FREQ=25 -DNO_CCMRAM
blackpill_f401.build.extra_flags=-DLED_BUILTIN=PC13 -DCRYSTAL_FREQ=25 -DNO_CCMRAM -DMCU_STM32F401CC
blackpill_f401.build.ldscript=ld/jtag.ld
blackpill_f401.build.variant=blackpill_f401
blackpill_f401.build.variant_system_lib=lib_f407.a
Expand Down Expand Up @@ -116,6 +117,60 @@ blackpill_f401.menu.opt.ogstd=Debug (-g)
blackpill_f401.menu.opt.ogstd.build.flags.optimize=-Og
blackpill_f401.menu.opt.ogstd.build.flags.ldspecs=
##############################################################
blackpill_f411.name=Blackpill STM32F411CEU6

blackpill_f411.menu.upload_method.STLinkMethod=STLink
blackpill_f411.menu.upload_method.STLinkMethod.upload.protocol=STLink
blackpill_f411.menu.upload_method.STLinkMethod.upload.tool=stlink_upload

blackpill_f411.upload.file_type=bin
blackpill_f411.upload.maximum_size=524288
blackpill_f411.upload.maximum_data_size=131072

blackpill_f411.build.core=maple
blackpill_f411.build.f_cpu=96000000
blackpill_f411.build.extra_flags=-DLED_BUILTIN=PC13 -DCRYSTAL_FREQ=25 -DNO_CCMRAM -DMCU_STM32F411CE
blackpill_f411.build.ldscript=ld/jtag.ld
blackpill_f411.build.variant=blackpill_f411
blackpill_f411.build.variant_system_lib=lib_f407.a
blackpill_f411.build.error_led_pin=PC13
blackpill_f411.build.board=blackpill_f411
blackpill_f411.build.vect_flags=-DUSER_ADDR_ROM=0x08000000

blackpill_f411.menu.usb_cfg.usb_serial=USB serial (CDC)
blackpill_f411.menu.usb_cfg.usb_serial.build.cpu_flags=-DSERIAL_USB
blackpill_f411.menu.usb_cfg.usb_nc=USB inactive
blackpill_f411.menu.usb_cfg.usb_nc.build.cpu_flags=-DUSB_NC
blackpill_f411.menu.usb_cfg.usb_msc=USB Mass Storage (MSC)
blackpill_f411.menu.usb_cfg.usb_msc.build.cpu_flags=-DUSB_MSC

#-- Optimizations
blackpill_f411.menu.opt.osstd=Smallest (default)
blackpill_f411.menu.opt.oslto=Smallest Code with LTO
blackpill_f411.menu.opt.oslto.build.flags.optimize=-Os -flto
blackpill_f411.menu.opt.oslto.build.flags.ldspecs=-flto
blackpill_f411.menu.opt.o1std=Fast (-O1)
blackpill_f411.menu.opt.o1std.build.flags.optimize=-O1
blackpill_f411.menu.opt.o1std.build.flags.ldspecs=
blackpill_f411.menu.opt.o1lto=Fast (-O1) with LTO
blackpill_f411.menu.opt.o1lto.build.flags.optimize=-O1 -flto
blackpill_f411.menu.opt.o1lto.build.flags.ldspecs=-flto
blackpill_f411.menu.opt.o2std=Faster (-O2)
blackpill_f411.menu.opt.o2std.build.flags.optimize=-O2
blackpill_f411.menu.opt.o2std.build.flags.ldspecs=
blackpill_f411.menu.opt.o2lto=Faster (-O2) with LTO
blackpill_f411.menu.opt.o2lto.build.flags.optimize=-O2 -flto
blackpill_f411.menu.opt.o2lto.build.flags.ldspecs=-flto
blackpill_f411.menu.opt.o3std=Fastest (-O3)
blackpill_f411.menu.opt.o3std.build.flags.optimize=-O3
blackpill_f411.menu.opt.o3std.build.flags.ldspecs=
blackpill_f411.menu.opt.o3lto=Fastest (-O3) with LTO
blackpill_f411.menu.opt.o3lto.build.flags.optimize=-O3 -flto
blackpill_f411.menu.opt.o3lto.build.flags.ldspecs=-flto
blackpill_f411.menu.opt.ogstd=Debug (-g)
blackpill_f411.menu.opt.ogstd.build.flags.optimize=-Og
blackpill_f411.menu.opt.ogstd.build.flags.ldspecs=
##############################################################
disco_f411.name=STM32 Discovery F411E

disco_f411.upload.tool=stlink_upload
Expand Down
2 changes: 2 additions & 0 deletions STM32F4/cores/maple/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ extern bool boardUsesPin(uint8 pin);
#include "discovery_f4.h"
#elif defined(VARIANT_blackpill_f401)
#include "blackpill_f401.h"
#elif defined(VARIANT_blackpill_f411)
#include "blackpill_f411.h"
#elif defined(VARIANT_disco_f411)
#include "disco_f411.h"
#elif defined(VARIANT_generic_f407v)
Expand Down
2 changes: 1 addition & 1 deletion STM32F4/variants/blackpill_f401/ld/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ SECTIONS
* I'm shoving these here naively; there's probably a cleaner way
* to go about this. [mbolivar]
*/
_lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : __data_end__;
_lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : __bss_end__;
_lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init;
} > REGION_RODATA

Expand Down
61 changes: 61 additions & 0 deletions STM32F4/variants/blackpill_f411/blackpill_f411.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/******************************************************************************
* The MIT License
*
* Copyright (c) 2011 LeafLabs, LLC.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*****************************************************************************/

/**
* @file blackpill_f411.cpp
* @author stevestrong
* @modified by board707
* @brief blackpill_f411 board file.
*/

#include "blackpill_f411.h"

#include <libmaple/gpio.h>
#include <libmaple/rcc.h>

#include <libmaple/libmaple_types.h>


void boardInit(void)
{
}


//extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
// 0, 1, 2, 3, 15, 16, 17, 19, 20, 21, 38, 39, 49, 41, 60, 61, 62, 63, 73, 75, 77, 78
//};
//
//extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
// 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 32, 33, 34, 35, 36, 37
//};
//
//extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
// BOARD_LED_PIN, BOARD_BUTTON_PIN, BOARD_JTMS_SWDIO_PIN,
// BOARD_JTCK_SWCLK_PIN, BOARD_JTDI_PIN, BOARD_JTDO_PIN, BOARD_NJTRST_PIN,
// 56, 58, 59, 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 78, 79, 81,
// 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
//};

93 changes: 93 additions & 0 deletions STM32F4/variants/blackpill_f411/blackpill_f411.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/******************************************************************************
* The MIT License
*
* Copyright (c) 2011 LeafLabs, LLC.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*****************************************************************************/

/**
* @file blackpill_f411.h
* @author stevestrong
* @modified by board707
* @brief Private include file
*/

#ifndef _BOARD_BLACKPILL_F411_H_
#define _BOARD_BLACKPILL_F411_H_


//#define Port2Pin(port, bit) ((port-'A')*16+bit)

#define CLOCK_SPEED_MHZ 96


#define BOARD_LED_PIN PC13

#define BOARD_USB_DM_PIN PA11
#define BOARD_USB_DP_PIN PA12

#define BOARD_NR_USARTS 3
#define BOARD_USART1_TX_PIN PA9
#define BOARD_USART1_RX_PIN PA10
#define BOARD_USART2_TX_PIN PA2
#define BOARD_USART2_RX_PIN PA3
//#define BOARD_USART6_TX_PIN PA11 // USB_DM
//#define BOARD_USART6_RX_PIN PA12 // USB_DP

#define BOARD_NR_I2C 1
#define BOARD_I2C1_SCL_PIN PB6
#define BOARD_I2C1_SDA_PIN PB7
#define BOARD_I2C1A_SCL_PIN PB8
#define BOARD_I2C1A_SDA_PIN PB9

#define BOARD_NR_SPI 3
#define BOARD_SPI1_NSS_PIN PA4
#define BOARD_SPI1_SCK_PIN PA5
#define BOARD_SPI1_MISO_PIN PA6
#define BOARD_SPI1_MOSI_PIN PA7

#define BOARD_SPI2_NSS_PIN PB12
#define BOARD_SPI2_SCK_PIN PB13
#define BOARD_SPI2_MISO_PIN PB14
#define BOARD_SPI2_MOSI_PIN PB15

#define BOARD_SPI3_NSS_PIN PA15
#define BOARD_SPI3_SCK_PIN PB3
#define BOARD_SPI3_MISO_PIN PB4
#define BOARD_SPI3_MOSI_PIN PB5

//#define BOARD_NR_GPIO_PINS 32
#define BOARD_NR_PWM_PINS 22
#define BOARD_NR_ADC_PINS 16
#define BOARD_NR_USED_PINS 43 // ala42 not set yet
#define BOARD_JTMS_SWDIO_PIN PA13
#define BOARD_JTCK_SWCLK_PIN PA14


enum {
PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12,PA13,PA14,PA15,
PB0,PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8,PB9,PB10,PB12=(PB10+2),PB13,PB14,PB15,
PC13=(32+13),PC14,PC15,
BOARD_NR_GPIO_PINS
};

#endif

0 comments on commit 9f32103

Please sign in to comment.