-
Notifications
You must be signed in to change notification settings - Fork 34
Support Nuvoton targets #25
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
Conversation
Can one of the admins verify this patch? |
.gitignore
Outdated
|
||
# Target-specific object files (force-include) | ||
!targets/TARGET_NUVOTON/** |
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.
Please remove targets from .gitignore
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.
Continuing #25 (comment), this is necessary to guarantee the secure image/lib are added into git. Notice .o files are excluded from git version control. This make secure library cmse_lib.o not versioned without the line !targets/TARGET_NUVOTON/**
.
.gitignore
# Compiled Object files *.slo *.lo *.o *.obj
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.
git add -f should do it?
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.
Yes, it do and recover .gitignore
mbed-os.lib
Outdated
@@ -1 +1 @@ | |||
https://github.com/ARMmbed/mbed-os/#7482462434d5cf718177653ef797547a976a7c5e | |||
https://github.com/ARMmbed/mbed-os/#b6e5a0a8afa34dec9dae8963778aebce0c82a54b |
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.
Please don't update Mbed OS.
However, this shouldn't be a problem now as it's using the same version that has been merged to master earlier.
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.
Rebase and the resultant mbed-os.lib has been 5.14.0. So need no change.
mbed_app.json
Outdated
"update-client.storage-address" : "(1024*1024*64)", | ||
"update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)", | ||
"update-client.storage-locations" : 1, | ||
|
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.
Please remove extra blank lines
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.
Fixed
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.
Please review feedback
In addition, please move these files to Mbed OS
|
@teetak01 do you want to have a look and comment? |
Make modifications:
|
@MarceloSalazar In mbed-os tree, there has been one pre-built secure image/lib which has the following memory partition but cannot afford pelion application. It is for general:
For pelion application, memory must be re-partitioned and the resultant secure image/lib must place in pelion application directory and the pre-built one in mbed-os tree must exclude:
Anyway, the root cause is limited memory: Cannot have a memory partition to meet both general and pelion. |
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 think the .o file really belongs to Mbed OS
drivers/storage/COMPONENT_NUSD.lib
Outdated
@@ -0,0 +1 @@ | |||
https://github.com/OpenNuvoton/NuMaker-mbed-SD-driver/#3221af84c7fd96b877ecd6d2c0863ba36eb9b1f2 |
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.
We could use here the COMPONENT_ naming to hide the driver when not needed
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.
@teetak01 Not clear. Would you comment more?
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.
#4 for example.
So it could be COMPONENT_NUMAKER_MBED_SD_DRIVER.lib
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.
@teetak01 Currently, the COMPONENT_
naming has been adopted. It is COMPONENT_NUSD
. Except for more verbose, change to COMPONENT_NUMAKER_MBED_SD_DRIVER
from COMPONENT_NUSD
? Though, COMPONENT_NUSD
has been used for some time.
"NUMAKER_PFM_NUC472": { "target.network-default-interface-type" : "ETHERNET", "target.bootloader_img" : "bootloader/mbed-bootloader-nuc472-block_device-kvstore-v4.1.0.bin", "target.header_offset" : "0x12000", "target.app_offset" : "0x12400", "target.components_add" : ["NUSD"], "nusd.provide-default-blockdevice" : true,
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.
Fine be me.
@teetak01 Do you mean cmse_lib.o? Due to memory limit #25 (comment), we can just provide a specilaized version for pelion application. |
Make modifications:
|
@ccli8 should we just fix the pre-build images in Mbed OS instead? What is the main usecase here? I am not sure do we want to support custom use-cases which might break with Mbed OS updates. Is there some other use-case which requires 256 KiB RAM for secure or would it just mean that this target does not meet the minimum requirements for Pelion? |
OK. The thinking seems more reasonable and we will meet less compatibility issue. I will update pre-built secure image/lib in mbe-os tree. |
rebuild |
run-ci |
This PR waits on ARMmbed/mbed-os#11594 to update default M2351 secure program in mbed-os tree which can have supported pelion application. This PR itself also needs modification to remove M2351 secure program to just link with the default one in mbed-os tree above. |
@ccli8 can you please split the PR to introduce support for one platform at a time? |
Make modifications:
|
Split this PR into 5:
|
Based on mbed-os-pelion-example master/mbed-bootloader 4.1.0/mbed-cloud-client 4.0.0, support Nuvoton targets: 1. Support Nuvoton targets: - NUMAKER_PFM_NUC472 - NUMAKER_PFM_M487 - NUMAKER_IOT_M487 V1.3 Compared to V1.2, V1.3 adds support for ESP8266 RTS/CTS/RST pins. V1.3 is incompatible with V1.2 on ESP8266. - NU_PFM_M2351_NPSA_NS - NUMAKER_IOT_M263A 2. Support M2351 (1) Use pre-built secure image/lib (2) Build by running: $ mbed compile -m NU_PFM_M2351_NPSA_NS -t ARMC6 3. With RoT, bootloader and client application must match: (1) Insecure (fake) RoT: Bootloader/mbed_lib.json: mbed-bootloader.use-kvstore-rot == 0 mbed-cloud-client/mbed_lib.json: mbed-cloud-client.external-sst-support == 0 (2) KVStore RoT: Bootloader/mbed_lib.json: mbed-bootloader.use-kvstore-rot == 1 mbed-cloud-client/mbed_lib.json: mbed-cloud-client.external-sst-support == 1 4. Change storage to NUSD (SD card in SDIO bus mode) from SD (SD card SPI bus mode) (1) Add COMPONENT_NUSD.lib. (2) Add component NUSD (target.components_add). (3) Change default BlockDevice to NUSD: Override BlockDevice::get_default_instance (nusd.provide-default-blockdevice). Required since mbed-cloud-client 2.1.0 (arm_uc_blockdevice_ext) or in: mbed-bootloader/modules/storage/pal-blockdevice/source/arm_uc_pal_blockdevice_mbed.cpp (4) Enable kvstore with blockdevice type being "other". i) Override get_other_blockdevice() (nusd.provide-kvstore-other-blockdevice). ii) Configure storage type to "FILESYSTEM". iii)Configure file system type to "LITTLE". vi) Configure block device type to "other". v) Configure external size to 64MiB, which cannot overlap with update-client. storage-address/update-client.storage-size. 5. Change back UARTSerial tx/rx buffer size from 1024/1024 to 256/256. This can reduce memory footprint by (1024 - 256) * 2 = 1.5KiB. Because this configuration influences both ESP8266 and default console (platfrom/mbed_retarget.cpp), memory reduction can achieve 1.5KiB x 2 = 3KiB. 6. Enlarge ESP8266 'send tcp data' timeout on Nuvoton targets Pelion connection has some failure rate with this. Enlarging ESP8266_SEND_TIMEOUT can just relieve the issue. A ticket has raised to address it: ARMmbed/mbed-os#11544 7. Requirements for mbed-os version: - mbed-os 5.13.0 (or afterwards) to support kvstore with block device type being "other" - mbed-os 5.13.1 (or afterwards) to fix 'undefined pal_plat_osEntropyInject(...)' error - mbed-os 5.14.0 (or afterwards) to support NUMAKER_IOT_M263A - mbed-os 5.14.0 (or afterwards) to support NU_PFM_M2351_NPSA_NS target renaming and combined build - mbed-os 5.14.? (or afterwards) to support NU_PFM_M2351_NPSA_S default secure program which has partitioned memory for Pelion application
This PR tries to add Nuvoton support for pelion application on the following targets:
Compare to other targets, Nuvoton support has the following major differences:
NUSD
rather thanSD
for external storage.NUSD
is SD card in SD bus mode and is on-board on Nuvoton targets. Because Mbed OS doesn't support SDIO HAL yet, provide its dedicated driverCOMPONENT_NUSD.lib
instead.Note: NU_PFM_M2351_NPSA_NS and NUMAKER_IOT_M263A require mbed-os to be 5.14.0 or afterwards.