Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChibiOS upgrade to v19.1.3 #7597

Merged
merged 24 commits into from
Feb 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
55cb1dd
First stab at getting ChibiOS upgraded.
tzarc Nov 16, 2019
4b38b3e
Handful of others now working again.
tzarc Dec 9, 2019
dfb50a0
More updates to boards.
tzarc Dec 9, 2019
b4ea462
More conversions of boards, hopefully.
tzarc Dec 10, 2019
473ef7c
Add fix for converter/siemens_tastatur getting PAL_USE_CALLBACKS rese…
tzarc Dec 11, 2019
2144d62
Restore unmodified/unformatted chibios config files if the upgrade sc…
tzarc Dec 11, 2019
e326336
Attempt to fix timers.
tzarc Dec 18, 2019
49deb18
Timer simplification, 100k back working.
tzarc Dec 19, 2019
bec83d5
Attempt to sort out 32-bit timer overflow arithmetic for 16-bit timers.
tzarc Dec 19, 2019
93b3764
Another attempt at fixing 16-bit timers.
tzarc Dec 19, 2019
dcdc03f
Disable LTO on ChibiOS builds.
tzarc Dec 19, 2019
52132ba
Change LTO to a message only.
tzarc Dec 19, 2019
cdb216d
Actually use proper makefile syntax for printing messages.
tzarc Dec 19, 2019
a4393a3
Collect ChibiOS and ChibiOS-Contrib versions during build.
tzarc Dec 23, 2019
9f255dc
Use 64-bit timer internally to match ChibiOS.
tzarc Dec 26, 2019
b534dd6
Simplified timer.
tzarc Dec 26, 2019
f95333a
Fix SPI-based WS2812 driver.
tzarc Jan 18, 2020
ee953dc
LTO fixes, interrupt handlers were being removed by LTO.
tzarc Jan 19, 2020
d9e51b4
Update updater script to take into account all available mcuconf upda…
tzarc Jan 27, 2020
a9e78b8
Fix up ldscript search order.
tzarc Jan 27, 2020
75036ef
Fix up another batch of boards.
tzarc Jan 28, 2020
976529e
Add breaking changes log entry.
tzarc Feb 2, 2020
ff94369
Add updated board/conf files
tzarc Feb 2, 2020
61821bc
Remove staging files.
tzarc Feb 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ id_rsa_*

# python things
__pycache__

# prerequisites for updating ChibiOS
/util/fmpp*
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[submodule "lib/chibios-contrib"]
path = lib/chibios-contrib
url = https://github.com/qmk/ChibiOS-Contrib
branch = k-type-fix
[submodule "lib/ugfx"]
path = lib/ugfx
url = https://github.com/qmk/uGFX
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// Configure glob patterns for excluding files and folders.
"files.exclude": {
"**/.build": true,
"**/*.hex": true
"**/*.hex": true,
"**/*.bin": true
},
"files.associations": {
"*.h": "c",
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -623,13 +623,19 @@ endif
# Generate the version.h file
ifndef SKIP_GIT
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
CHIBIOS_VERSION := $(shell cd lib/chibios && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
CHIBIOS_CONTRIB_VERSION := $(shell cd lib/chibios-contrib && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
else
GIT_VERSION := NA
CHIBIOS_VERSION := NA
CHIBIOS_CONTRIB_VERSION := NA
endif
ifndef SKIP_VERSION
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h)
$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h)
$(shell echo '#define CHIBIOS_VERSION "$(CHIBIOS_VERSION)"' >> $(ROOT_DIR)/quantum/version.h)
$(shell echo '#define CHIBIOS_CONTRIB_VERSION "$(CHIBIOS_CONTRIB_VERSION)"' >> $(ROOT_DIR)/quantum/version.h)
else
BUILD_DATE := NA
endif
Expand Down
15 changes: 15 additions & 0 deletions docs/ChangeLog/20200229/PR7597.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Update ChibiOS/ChibiOS-Contrib/uGFX submodules

* General notes
* A `make git-submodule` may be required after pulling the latest QMK firmware code to update affected submodules to the upgraded revisions
* Enabling link-time-optimization (`LINK_TIME_OPTIMIZATION_ENABLE = yes`) should work on a lot more boards
* Upgrade to ChibiOS ver19.1.3
* This will allow QMK to update to upstream ChibiOS a lot easier -- the old version was ~2 years out of date. Automated update scripts have been made available to simplify future upgrades.
* Includes improved MCU support and bugfixes
* ChibiOS revision is now included in Command output
* Timers should now be more accurate
* Upgrade to newer ChibiOS-Contrib
* Also includes improved MCU support and bugfixes
* ChibiOS-Contrib revision is now included in Command output
* Upgrade to newer uGFX
* Required in order to support updated ChibiOS
8 changes: 4 additions & 4 deletions drivers/arm/i2c_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length,
#endif

i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (address >> 1), data, length, 0, 0, MS2ST(timeout));
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (address >> 1), data, length, 0, 0, TIME_MS2I(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
Expand All @@ -98,7 +98,7 @@ i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16
#endif

i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (address >> 1), data, length, MS2ST(timeout));
msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (address >> 1), data, length, TIME_MS2I(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
Expand All @@ -120,7 +120,7 @@ i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data,
}
complete_packet[0] = regaddr;

msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (devaddr >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout));
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (devaddr >> 1), complete_packet, length + 1, 0, 0, TIME_MS2I(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
Expand All @@ -135,7 +135,7 @@ i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16
#endif

i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (devaddr >> 1), &regaddr, 1, data, length, MS2ST(timeout));
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (devaddr >> 1), &regaddr, 1, data, length, TIME_MS2I(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
Expand Down
2 changes: 1 addition & 1 deletion drivers/arm/ws2812_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void ws2812_init(void) {

// TODO: more dynamic baudrate
static const SPIConfig spicfg = {
NULL, PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN),
0, NULL, PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN),
SPI_CR1_BR_1 | SPI_CR1_BR_0 // baudrate : fpclk / 8 => 1tick is 0.32us (2.25 MHz)
};

Expand Down
178 changes: 154 additions & 24 deletions drivers/boards/GENERIC_STM32_F303XC/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,172 @@
limitations under the License.
*/

/*
* This file has been automatically generated using ChibiStudio board
* generator plugin. Do not edit manually.
*/

#include "hal.h"
#include "stm32_gpio.h"

/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/

/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/

/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/

/**
* @brief Type of STM32 GPIO port setup.
*/
typedef struct {
uint32_t moder;
uint32_t otyper;
uint32_t ospeedr;
uint32_t pupdr;
uint32_t odr;
uint32_t afrl;
uint32_t afrh;
} gpio_setup_t;

/**
* @brief Type of STM32 GPIO initialization data.
*/
typedef struct {
#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
gpio_setup_t PAData;
#endif
#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
gpio_setup_t PBData;
#endif
#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
gpio_setup_t PCData;
#endif
#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
gpio_setup_t PDData;
#endif
#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
gpio_setup_t PEData;
#endif
#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
gpio_setup_t PFData;
#endif
#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
gpio_setup_t PGData;
#endif
#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
gpio_setup_t PHData;
#endif
#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
gpio_setup_t PIData;
#endif
#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
gpio_setup_t PJData;
#endif
#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
gpio_setup_t PKData;
#endif
} gpio_config_t;

#if HAL_USE_PAL || defined(__DOXYGEN__)
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
* This variable is used by the HAL when initializing the PAL driver.
* @brief STM32 GPIO static initialization data.
*/
const PALConfig pal_default_config = {
# if STM32_HAS_GPIOA
static const gpio_config_t gpio_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
#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
#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
#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
#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
#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
#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
#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
#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
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif
};

/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/

static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
gpiop->OTYPER = config->otyper;
gpiop->OSPEEDR = config->ospeedr;
gpiop->PUPDR = config->pupdr;
gpiop->ODR = config->odr;
gpiop->AFRL = config->afrl;
gpiop->AFRH = config->afrh;
gpiop->MODER = config->moder;
}

static void stm32_gpio_init(void) {
/* Enabling GPIO-related clocks, the mask comes from the
registry header file.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(STM32_GPIO_EN_MASK, true);

/* Initializing all the defined GPIO ports.*/
#if STM32_HAS_GPIOA
gpio_init(GPIOA, &gpio_default_config.PAData);
#endif
#if STM32_HAS_GPIOB
gpio_init(GPIOB, &gpio_default_config.PBData);
#endif
#if STM32_HAS_GPIOC
gpio_init(GPIOC, &gpio_default_config.PCData);
#endif
#if STM32_HAS_GPIOD
gpio_init(GPIOD, &gpio_default_config.PDData);
#endif
#if STM32_HAS_GPIOE
gpio_init(GPIOE, &gpio_default_config.PEData);
#endif
#if STM32_HAS_GPIOF
gpio_init(GPIOF, &gpio_default_config.PFData);
#endif
#if STM32_HAS_GPIOG
gpio_init(GPIOG, &gpio_default_config.PGData);
#endif
#if STM32_HAS_GPIOH
gpio_init(GPIOH, &gpio_default_config.PHData);
#endif
#if STM32_HAS_GPIOI
gpio_init(GPIOI, &gpio_default_config.PIData);
#endif
#if STM32_HAS_GPIOJ
gpio_init(GPIOJ, &gpio_default_config.PJData);
#endif
#if STM32_HAS_GPIOK
gpio_init(GPIOK, &gpio_default_config.PKData);
#endif
}

void enter_bootloader_mode_if_requested(void);

Expand All @@ -62,6 +190,8 @@ void enter_bootloader_mode_if_requested(void);
*/
void __early_init(void) {
enter_bootloader_mode_if_requested();

stm32_gpio_init();
stm32_clock_init();
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Driver hardware support. */
/*===========================================================================*/

# define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
# define GDISP_HARDWARE_DRAWPIXEL TRUE
# define GDISP_HARDWARE_PIXELREAD TRUE
# define GDISP_HARDWARE_CONTROL TRUE
# define GDISP_HARDWARE_FLUSH GFXON // This controller requires flushing
# define GDISP_HARDWARE_DRAWPIXEL GFXON
# define GDISP_HARDWARE_PIXELREAD GFXON
# define GDISP_HARDWARE_CONTROL GFXON

# define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256

Expand Down
10 changes: 5 additions & 5 deletions drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
/* Driver hardware support. */
/*===========================================================================*/

# define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
# define GDISP_HARDWARE_DRAWPIXEL TRUE
# define GDISP_HARDWARE_PIXELREAD TRUE
# define GDISP_HARDWARE_CONTROL TRUE
# define GDISP_HARDWARE_BITFILLS TRUE
# define GDISP_HARDWARE_FLUSH GFXON // This controller requires flushing
# define GDISP_HARDWARE_DRAWPIXEL GFXON
# define GDISP_HARDWARE_PIXELREAD GFXON
# define GDISP_HARDWARE_CONTROL GFXON
# define GDISP_HARDWARE_BITFILLS GFXON

# define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO

Expand Down
Loading