-
Notifications
You must be signed in to change notification settings - Fork 64
platform: Add support of frdmmcxn947 #157
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
base: zephyr_tf-m_v2.2.2
Are you sure you want to change the base?
platform: Add support of frdmmcxn947 #157
Conversation
0afb63a to
55ca99f
Compare
55ca99f to
6c4e958
Compare
|
Hi @stgloorious. May I ask, if this PR will be merged for #154. |
@waqar-tahir It would be nice to merge it into Zephyr tf-m 2.2.2 if possible. The prerequisite for this, #159, was already cherry-picked into #154. What is the plan/policy here, @tomi-font ? |
|
Hey, I am not gonna include this as part of the 2.2.2 update as this is purely adding support for a new platform. #159, on the other hand, fixed something that we already had in-tree so I cherry-picked it to be able to get rid of 5a5eea0. |
|
Makes sense @tomi-font, thanks. |
|
The default branch of this repository is being changed to |
Add support to the vprintf implementation for left formatting. This applies to both integer format specifiers and strings. The implementation also allows us to tidy up the existing integer format specifier parser. Change-Id: If7bcc07712a14de76294b9a7a1f6f637380ed714 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 44a5153)
Make use of the new tfm_log library for logging from BL2. We achieve this by redefining the MCUBOOT_LOG_ macros in TF-M to use the tfm_log macros instead of printf. The log level is mapped from the configured MCUBoot value to the value used by tfm_log and we add a CPP check to ensure that the two match correctly. Change-Id: I6dd24bd53008a779ab5fa282153a8c8d5c4e5741 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit a6a90c3)
These macros allow for printing raw strings without any prefix (such as [DGB] etc.). They are useful for porting existing logging library usage to the new logging API. Change-Id: I90acbfb3fb0c9bbe8fc3938b7ac79a82d2151138 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 5188b1e)
Follows the same logic as in ac7219e. Change-Id: I211cb321d442bac74fc62c966e2330f75ad91271 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit a054b3f)
Remove these to ensure that these interface targets only provide the tfm_log.c and tfm_log_unpriv.c source files and nothing else. This allows targets to individually link the tfm_vprintf.c source file. Change-Id: I5c00665d361ff9fab5b6316104d5a743336b8917 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit e74fa6f)
Previously, the tfm_log_unpriv implementation dropped strings that could not fit in the 32 byte buffer. Rework the implementation to instead output them directly to the SVC call, without using the buffer. Change-Id: Ib976bef538d7efdf30a64e3a2091ca1ebfd15764 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 8eb243c)
Add the implementation of vprintf for unprivileged logging. This function follows the same signature as the standard library vprintf. Change-Id: I512e1835c0c93e72be46f06508c1b66d67587dbf Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 4d5ce0e)
Make use of the new unprivileged logging API throughout the secure partitions. This mainly does drop in replacements for the existing macros to the new LOG_UNPRIV macros. Note that as part of this change, we replace the existing remove tfm_sp_log_raw.c which implemented the vprintf standard library function. This function is still by some platforms and external libraries in TF-M and therefore we add a new implementation which makes use of the implementation in the new unpriv logging library. Change-Id: I58c7f71fabab0984fe42560c6c20ca313bd5aa60 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 1f2c7fd)
Replace the existing SPM log library with the new tfm_log library. This patch aims to maintain existing behaviour by using a format specifier which matches the existing implementation. Change-Id: I5871b5429e4f051fdede87063bfe3ebbe49847f9 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit af54602)
Replace the existing implementation which used printf. Change-Id: Ie3e37eb905583c8793578bc138e6cc11222f378e Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 182bcbf)
Instead of verifying that the LOG_LEVEL matches the MCUBOOT_LOG_LEVEL, completely ignore the definition of LOG_LEVEL for MCUBoot logging and ensure that instead we only use the MCUBOOT_LOG_LEVEL macro to determine the level to log at. We achieve this by setting the LOG_LEVEL to LOG_LEVEL_VERBOSE which compiles in all logging macros and allow the MCUBOOT_LOG_LEVEL to set which level to log at. Change-Id: I343774306734499b691fde04cd87626ff6d13add Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 1fe05e9)
The vprintf implementation in crt_vprintf.c should return the number of characters printed (as that is the standard signature of vprintf). Rework the tfm_vprintf_unpriv implementation to count the number of characters printed to the UART and return them. Change-Id: I26f9f4efdede685c1e82294859ef3ce1fcf45fcd Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit b311830)
This function should not be accessed outside of the tfm_log and tfm_log_unpriv libraries and therefore does not need to be exposed in the public header. Add a new private header which is then included by the logging source files. Change-Id: Ic6ca5d4ad753b6e6abaedaf27d0b17b9ebe6f1b3 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit ccf42f2)
The underlying tfm_vprintf function can now be called tfm_vprintf_unpriv, which is called from the runtime FW vprintf implementation. This function will be called without a marker character at the beginning of the string and therefore will cause an assertion to be triggered within the vprintf implementation. Add a new argument which specifies whether or not there is a marker character. Change-Id: I58bc8cfa44f348766408d6e1fcf3fa995c3f6131 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit b59d3fb)
Completely replace the MCUBOOT_LOG_LEVEL with TFM_BL2_LOG_LEVEL, which specifies the log level to use for all of BL2. Change-Id: I2e454c6709d32d283454730d11b4b22d7c550071 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit aa09e6f)
Link this target which provides the tfm_vprintf headers to each of the logging library header targets. This prevents users of the logging libraries from having to explicitly link both of the header targets. Change-Id: I043e51cdb1567fcb971e480474dfebf46c7688a8 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 79aa055)
Although %d is already present, extend with %i so it is easier to introduce work-in-progress patches. Signed-off-by: Nicola Mazzucato <[email protected]> Change-Id: I9637c514f44bf78c9a4acb3b3a4934fc72c01c8f (cherry picked from commit 18c84d7)
In tfm_vprintf.c, if the calculate_length flag is set and the string
passed to output_str is NULL, then the program would dereference the
NULL pointer as per the following warning:
warning: potential null pointer dereference [-Wnull-dereference]
64 | while (*str_ptr++ != '\0') {
| ^~~~~~~~~~
Fix this by adding an assertion that the string is non-NULL and
returning from the function in the case of release builds.
Change-Id: Ibc9fe50a19c8255298ea69b22770f8a255ad9266
Signed-off-by: Jackson Cooper-Driver <[email protected]>
(cherry picked from commit 3e369bd)
Add support for printing hex values in capitals when using the %X format specifier. Change-Id: I5f914164963b704689e388b14c9d96c5c59ee552 Signed-off-by: Jackson Cooper-Driver <[email protected]> (cherry picked from commit 2b9877121c1e84d2ff1d98c1ec9bdca3d1e205b5)
The commit adds support for the ARM Cortext-M33 based NXP frdmmcxn947 development board to Trusted Firmware-M (TF-M). This includes: - Native peripheral driver for Flash and LPUART - System, Flash and RAM configuration files for dual-core CM33 architecture - Platform Native drivers from MCUX SDK - TF-M target configuration for secure/non-secure domains - s/ns board configuration for FRDM-MCXN947 - Platform documentation added - updates in common hal files to be re-used by multiple NXP platforms. This imporoves code reusability and standardization across NXP MCU platforms Change-Id: I6ad23001d1e79dda786ff858c686465cd89f6b5b Signed-off-by: Waqar Tahir <[email protected]> (cherry picked from commit 90a6a81d6ec12519927dc16c84688d65a88273f3)
6c4e958 to
04af9b0
Compare
|
Thanks; rebased and renamed commits. |
tomi-font
left a comment
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.
Do you have a Zephyr PR which pulls this in?
|
No, the Zephyr integration is not ready to be upstreamed yet. We are working on it. |
Support for NXP FRDM-MCXN947 board.
Cherry-pick commits from upstream to introduce new log macros.
Prerequisite to also pull in new board support, e.g., NXP FRDM-MCXN947.
Cherry-picked from https://review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/44162
cc @waqar-tahir
No conflicts occured.
Some changes are necessary to Zephyr as well. With these changes, I can build and boot TF-M successfully: