Skip to content

Commit

Permalink
ChibiOS upgrade to v19.1.3 (#7597)
Browse files Browse the repository at this point in the history
* First stab at getting ChibiOS upgraded.

* Handful of others now working again.

* More updates to boards.

* More conversions of boards, hopefully.

* Add fix for converter/siemens_tastatur getting PAL_USE_CALLBACKS reset during upgrade.

* Restore unmodified/unformatted chibios config files if the upgrade scripts did nothing to them.

* Attempt to fix timers.

* Timer simplification, 100k back working.

* Attempt to sort out 32-bit timer overflow arithmetic for 16-bit timers.

* Another attempt at fixing 16-bit timers.

* Disable LTO on ChibiOS builds.

* Change LTO to a message only.

* Actually use proper makefile syntax for printing messages.

* Collect ChibiOS and ChibiOS-Contrib versions during build.

* Use 64-bit timer internally to match ChibiOS.

* Simplified timer.

* Fix SPI-based WS2812 driver.

* LTO fixes, interrupt handlers were being removed by LTO.

* Update updater script to take into account all available mcuconf updaters (prep for future versions)

* Fix up ldscript search order.

* Fix up another batch of boards.

* Add breaking changes log entry.

* Add updated board/conf files

* Remove staging files.
  • Loading branch information
tzarc authored and noroadsleft committed Feb 8, 2020
1 parent 8cbd3b5 commit 8df16a5
Show file tree
Hide file tree
Showing 159 changed files with 21,923 additions and 3,853 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,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

0 comments on commit 8df16a5

Please sign in to comment.