cancel
Showing results for 
Search instead for 
Did you mean: 

Build Error in STM32F1xx Standard Peripheral Library (misc.c) with MDK v6

F4Corsair
Visitor

I am reporting a compilation error that occurs when using the STM32F1xx Standard Peripheral Library (SPL) in Keil MDK v6 (specifically using the RTE pack downloaded via Arm Keil Studio for VS Code). This issue is caused by a naming mismatch in the NVIC structure between the legacy SPL and the latest CMSIS core headers.

In the latest CMSIS core headers, the Interrupt Priority Register in the NVIC structure is defined as IPR. However, the misc.c file in the Standard Peripheral Library still refers to it as IP.

Error Message: ~/.cache/arm/packs/Keil/STM32F1xx_DFP/2.4.1/Device/StdPeriph_Driver/src/misc.c:131:11: error: no member named 'IP' in 'NVIC_Type'

Technical Details & Suggested Fix: The bug is located in the STM32F1xx_DFP/2.4.1/Device/StdPeriph_Driver/src/misc.c file, specifically around line 131 within the NVIC_Init function.

To ensure out-of-the-box compatibility for MDK v6 users, I propose updating the current code:

NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;

to use the IPR member instead:

NVIC->IPR[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;

 

Environment:

  • IDE: Keil MDK v6 (VS Code extension)

  • Device: STM32F103C8 series

  • Library: STM32F10x_StdPeriph_Driver (v3.6.0)

  • RTE Pack: Keil::STM32F1xx_DFP (v2.4.1)

1 REPLY 1
Andrew Neil
Super User

@F4Corsair wrote:

caused by a naming mismatch in the NVIC structure between the legacy SPL and the latest CMSIS core headers.)


As you say, SPL is (and has been for a long time) a legacy product - so it's not surprising that it doesn't match up with the latest CMSIS.

 


@F4Corsair wrote:

To ensure out-of-the-box compatibility for MDK v6 users


If you want out-of-the-box compatibility, then you need to use compatible versions - not legacy versions.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.