RFC: API Change: flash_area #34706


Ermel, Dominik
 

Hello,

 

Some time ago I have posted flash_area changes, that have been only changing how device binding is performed, that has not been accepted (enhancement discussion “Use compile time resolved device bindings in flash map, when possible” , https://github.com/zephyrproject-rtos/zephyr/issues/34227) and it has been proposed to change flash_area to actually provide only features that Zephyr requires and limit the internals of flash_ara structure.

 

That has spawned my work on the subject that was intended to keep compatibility with existing solution and work, also with mcuboot, to make the changes and limit impact on the project.

As a result I have created the RFC RPs with preliminary solution that covers mcuboot and most of Zephyr so far:
mcuboot https://github.com/mcu-tools/mcuboot/pull/982
Zephyr https://github.com/zephyrproject-rtos/zephyr/pull/34530

 

And created RFC that summarizes the changes: https://github.com/zephyrproject-rtos/zephyr/issues/34706

 

The idea is to not add additional layer, reduce flash_area object size and code.

 

So far I have been able to successfully test changes with mcuboot, with slightly reduced flash occupancy, and all tests for flash_area that exist have been running successfully, with slight changes.

The proposed change allows to use flash_area API with IDs and by directly accessing the flash_area objets: my intention is to leave access via ID possible for external entities that use flash_area_open function to get access to area and at the same time change internal, within Zephyr repo code base, access to directly use flash_area objects which can now be obtained by FLASH_AREA(…) macro that works similar to existin FLASH_AREA_ID(..) macro, but returns flash_area object pointer instead of ID.

 

There is still work ongoing on documentation needed and additional test cases but due to kept compatibility with existing solution the transition should be quite simple and reliable.

 

Best regards,

Dominik Ermel


Dominik ERMEL | Senior Software Engineer
M +48 505 071 130 | Kraków, Poland
nordicsemi.com | devzone.nordicsemi.com

Nordic_logo_signature

 

Join devel@lists.zephyrproject.org to automatically receive all group messages.