Skip to content

drivers: misc: ethos_u: support nuvoton numaker m55m1x #88941

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ccli8
Copy link
Contributor

@ccli8 ccli8 commented Apr 23, 2025

This supports Nuvoton's M55M1 Ethos-U NPU. Besides, the tflm_ethosu sample is refined for this target's verification, including:

  1. Fix undefined _fini symbol on invoking exit() for newlib libc
  2. Add missing inclusion of stdint.h for e.g. uint8_t type
  3. Fix unsafe thread stack allocation. Use canonical K_THREAD_STACK_DEFINE or friends instead of raw buffer
  4. Refactor Vela-compiled models which must match target Ethos-U RTL config
  5. Add non-Vela-compiled model for evaluation of no-Ethos-U platform
  6. Add support for numaker_m55m1 board

NOTE: This PR covers #88218.

Comment on lines +303 to +321
/* Address undefined _fini for the exit call
*
* With gcc command-line options -nostartfiles or -nostdlib, the gcc
* built-in object files crti.o/crtn.o which implement _init/_fini
* won't get linked in automatically and will cause undefined reference
* to _fini error when exit is invoked.
*
* This is fixed by providing one dummey _fini to let linker pass.
*/
__weak void _fini(void)
{
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khoa-nguyen-18
Copy link
Contributor

Hi @ccli8, could you share your output log when running the tflite-micro/tflm_ethosu sample on the M55M1 board?

ccli8 added 5 commits May 28, 2025 13:13
With gcc command-line options -nostartfiles or -nostdlib, the gcc
built-in object files crti.o/crtn.o which implement _init/_fini
won't get linked in automatically and will cause undefined reference
to _fini error when exit is invoked.

This is fixed by providing one dummey _fini to let linker pass.

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
Add header file stdint.h so that fixed width integer type
e.g. uint8_t can use without compile error.

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
It is unsafe to pass raw buffer as thread stack. Instead, use canonical
K_THREAD_STACK_DEFINE or friends to define thread stack.

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
This addes frontend of arm ethos-u core driver for nuvoton numaker m55m1x.
Special notes include:
1. Leaving application overriding dcache flush/invalidate weak functions
   for cacheable NPU buffer
2. Configuring macs_per_cc to 256 in arm ethos-u core driver to match
   m55m1x ethos-u RTL config

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
This supports nuvoton numaker_m55m1 board, including:
1. Choosing NPU buffer as cacheable or non-cacheable, dependent on
   CONFIG_NOCACHE_MEMORY. When cachealbe is chosen, data cache flush/
   invalidate weak functions (ethos-u core driver) are also overridden.
2. Add Vela-compiled model which matches this targets's NPU, Ethos-U55
   with 256 macs_per_cc

Besides, re-organize for new board support, including:
1. Refactor Vela-compiled models which must match target Ethos-U RTL config
2. Add non-Vela-compiled model for evaluation of no-Ethos-U platform

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
Copy link

@ccli8
Copy link
Contributor Author

ccli8 commented May 28, 2025

Log of tflite-micro/tflm_ethosu on numaker_m55m1 board:

*** Booting Zephyr OS build v4.1.0-4815-g794bbb7d8013 ***
sender 0: Sending inference. job=0x20117518, name=keyword_spotting_cnn_small_int8
runner 0: Received inference job. job=0x20117518
runner 0: Sending inference response. job=0x20117518
sender 0: Sending inference. job=0x20117564, name=keyword_spotting_cnn_small_int8
runner 0: Received inference job. job=0x20117564
runner 0: Sending inference response. job=0x20117564
sender 0: Received job response. job=0x20117518, status=0
sender 0: Received job response. job=0x20117564, status=0
sender 1: Sending inference. job=0x20117d18, name=keyword_spotting_cnn_small_int8
runner 0: Received inference job. job=0x20117d18
runner 0: Sending inference response. job=0x20117d18
sender 1: Sending inference. job=0x20117d64, name=keyword_spotting_cnn_small_int8
runner 0: Received inference job. job=0x20117d64
runner 0: Sending inference response. job=0x20117d64
sender 1: Received job response. job=0x20117d18, status=0
sender 1: Received job response. job=0x20117d64, status=0
exit

@khoa-nguyen-18
Copy link
Contributor

Hi @ccli8, I believe the content of PR #90787 might be related to your work. Could you please take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants