-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSAL APIs to read/write firmware #27
base: osal
Are you sure you want to change the base?
Conversation
Hi @manojnacsl ! My current errors are from the linux build:
|
@ismilak Regarding the earlier build errors for FreeRTOS/EFR32, as informed in the previous call - our intent was to only add the platform agnostic CSMP encode/decode changes for FreeRTOS/EFR32 in the interest of time - there could be trivial build errors on these platforms which could be addressed during integration. Linux taget built fine and was used for manual testing. |
FILE *file = NULL; | ||
|
||
switch(slotid) { | ||
case RUN_IMAGE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the enumeration be in osal.h? It will be required for other platforms too. If csmp_info is a library header, the enumeration should be moved into osal.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, the slots are owned by the osal an consumed by the csmp agent library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ismilak @silabs-ThibautC - thanks for your feedback. Sounds good, I'll move the declaration of xxx_IMAGE enum and _Csmp_Slothdr to osal.h and accordingly update the API signature.
* @brief read firmware image from storage(file/flash) | ||
* | ||
* input parameters | ||
* @param[in] slotid indicating RUN/UPLOAD/BACKUP slot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My recommendations for the new APIs:
- slotid type should be osal_basetype_t to be consistent
- _Csmp_Slothdr can be defined in osal_platform_types.h. In this case it can be portable for different platforms, using void* to access raw data is not a "safe" solution. Using appropriate type has more benefits.
- size should be osal_ssize_t or we can introduce a new unsigned size type (this argument is not required if the slot hdr is defined in osal_platform_types.h )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ismilak - thanks for your feedback. Sounds good, I'll move the declaration of xxx_IMAGE enum and _Csmp_Slothdr to osal.h and accordingly update the API signature.
I still think we are missing an OSAL API for rebooting. That said. After reviewing how the OTA DFU TLV handlers were implemented I understand why there are none. I was surprised to see that all of them were in a platform-specific file or folder. I didn't pay attention to that detail when I did my first quick review in December. I was expecting the OTA DFU logic (e.g., when imageBlock_post is called, do what you have to do then call osal_write_firmware, and so on) to be common to all platforms and located in a common folder. As it stands, we theoretically wouldn't need the OSAL read/write functions. We could call SiliconLabs APIs in efr32_wisun_tlvs.c. However, there's a lot of code duplication. We have 1168 common lines (out of 1319) between efr32_wisun_tlvs.c and linux_tlvs.c. This increases the maintenance burden and will slow down the adoption of new platforms. It's critical to minimize platform-specific code. As a CSMP agent consumer, what I'd like to see very explicitly exposed in the repo is what part of the repo is ready to be consumed as-is and which needs to be done to have a basic application. My vision is that it should be done in sample/ |
A reboot OSAL API can be implemented and the plan to implement this API was discussed to be implemented along with Reboot_Request TLV32 as they are directly related. The rest of the comments regarding xxx_tlvs.c implementation code for firmware upgrade is not very clear here and could be discussed in our sync-up call. Though there could be code which seems similar across osal platforms, the current implementation is inline to segregating code across Agent and platform specific Sample application - we need to discuss this further for better clarity on the proposal. Thanks. |
@silabs-ThibautC : As informed earlier in our discussions, the scope of this PR is to propose firmware read/write OSAL APIs. We had also confirmed earlier that OSAL API for reboot could be implemented along with TLV32 as a separate PR. Further restructuring/optimizing of existing code(firmware upgrade, etc.,) being proposed now are out of scope of this PR and let's take it up for discussion separately as your FreeRTOS/EFR32 integration progresses. Thanks. |
Proposed OSAL APIs to read/write firmware