MICROPHY_HW_FLASH_LATENCY compile error

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
User avatar
roland_vs
Posts: 89
Joined: Tue Dec 08, 2015 8:28 pm
Location: Netherlands
Contact:

MICROPHY_HW_FLASH_LATENCY compile error

Post by roland_vs » Tue May 30, 2017 1:40 pm

Just a minor thing but if one omits the MICROPY_HW_FLASH_LATENCY in the mpconfigboard.h of the STM32L476xx related boards an error pops up when compiling. See the files in /hal/L4/inc/stm32l4xx_hal_flash.h and /hal/F4/inc/stm32f4xx_hal_flash_ex.h for more.

I added this at two places to resolve it.

In modmachine.c @ line 384

Code: Select all

            #if !defined(MICROPY_HW_FLASH_LATENCY)
              #if defined(MCU_SERIES_L4)
              #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_4
              #else
              #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_5
              #endif
            #endif
And in system_stm32.c @ line 432

Code: Select all

#if !defined(MICROPY_HW_FLASH_LATENCY)
  #if defined(MCU_SERIES_L4)
  #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_4
  #else
  #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_5
  #endif
#endif

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: MICROPHY_HW_FLASH_LATENCY compile error

Post by Damien » Wed May 31, 2017 4:17 am

Thanks for the report, but in this case I'd say it's better to require the individual board config to define MICROPY_HW_FLASH_LATENCY. Otherwise the main code has too many automagic configuration selections.

Post Reply