Luos-io/Documentation

Missing documentation about LuosHAL and how to deal with configs.

fleborne opened this issue · 9 comments

It seems that the address used for ADDRESS_LAST_PAGE_FLASH is not suited for STM32F051. It is set to ((uint32_t)0x0801F800):

https://github.com/Luos-io/LuosHAL/blob/5bc3d62a768445a520dab0d9b869db1c0d467eb4/STM32F0/luos_hal_config.h#L133

but according to ST's RM0091 Reference manual (page 55/1004), the main flash memory of STM32F051s stops at 0x0800FFFF. Changing ADDRESS_LAST_PAGE_FLASH to ((uint32_t)0x0800F800) solves the problem.

I am not sure this is actually the problem here, but if I don't make this modification, the creation of the Luos container leads the a hardware fault during this call to memset in LuosHAL_FlashReadLuosMemoryInfo:

https://github.com/Luos-io/LuosHAL/blob/5bc3d62a768445a520dab0d9b869db1c0d467eb4/STM32F0/luos_hal.c#L584

image

LuosHAL/STM32F0/luos_hal_config.h is a default configuration for STM32F0 family. this default configuration must be change to fit with you design and your MCU by define in your project before calling luos.h ADDRESS_LAST_PAGE_FLASH with the right value find in the datasheet

I think your problem here is a lack of documentation about how to deal with LuosHAL.
I will move this ticket on documentation.

We should document the usage of LuosHAL configuration avoiding misunderstanding about how to use it.

Ok, understood.

It would indeed be useful / necessary to have a document listing all the HAL parameters that need to be adjusted for each MCU.

Hi,

I think using FLASH_BANK1_END as the default value for ADDRESS_LAST_PAGE_FLASH could fix the originally described problem, as it is automatically correctly defined for each board.

This macro is defined in framework-stm32cube\f0\Drivers\CMSIS\Device\ST\STM32F0xx\Include\stm32f051x8.h (for the SMT32F051) when using the STM32Cube framework.

Well, it should actually be

#define ADDRESS_LAST_PAGE_FLASH (FLASH_BANK1_END - FLASH_PAGE_SIZE + 1)

to address the beginning of the last page...

@nicolas-rabault, is this issue still open?

I think @ncros3 change some things about this on the RC2.0.0 : Luos-io/LuosHAL#27
@ncros3 does it rings any bell for you?

There was a problem in the last address page calculation. It's fixed in the rc-2.0.0.