Skip to content
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

boards: nuvoton: add support for numaker m2l31ki #70357

Merged
merged 1 commit into from Mar 21, 2024

Conversation

cyliangtw
Copy link
Contributor

This PR is to add the new development board numaker_m2l31ki for m2l31x series.

It's verified on NuMaker-M2L31KI EVB by the test code of blinky, hello_world, gpio_basic_api & flash/common.

@zephyrbot zephyrbot added the platform: Nuvoton Numicro Numaker Nuvoton Technology Corporation, Numicro Numaker label Mar 18, 2024
@zephyrbot zephyrbot requested a review from ssekar15 March 18, 2024 08:39
Comment on lines 7 to 9
if BOARD_NUMAKER_M2L31KI

endif # BOARD_NUMAKER_M2L31KI
Copy link
Collaborator

Choose a reason for hiding this comment

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

delete file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks of your advice, I deleted this redundant file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Make this a webp and use https://tinypng.com/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it already made by this tool to save 13% ~ 14%.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The 1st commit jpg file was made by this webp, improved file size from 83KB to 72KB.

#address-cells = <1>;
#size-cells = <1>;

slot0_partition: partition@0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How are these slots used if there is no bootloader?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These proposed slots should be used by bootloader.

In \tests\drivers\flash\common\src, it will utilize the
#define TEST_AREA storage_partition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Application has update client capacity and could download new firmware & write it into slot1 in runtime.
As while bootloader detect new firmware in slot1, it could clone into slot0 and set as active image.

Copy link
Collaborator

@nordicjm nordicjm Mar 18, 2024

Choose a reason for hiding this comment

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

Is this an inbuilt bootloader on the MCU itself? i.e. in mask ROM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's not the mask ROM.
Slot0 & Slot1 belong to APROM.
The chip has one LDROM ( loader-rom), user could program the loader (i.e small firmware).

Copy link
Collaborator

Choose a reason for hiding this comment

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

My question is do these work out of the box or does someone need to build and load their own bootloader e.g. mcuboot? If this works out of the box then this can be marked as resolved, if they need e.g. mcuboot or another bootloader which they need to flash themselves then there should be a partition here for that bootloader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It need one bootloader, so I add one more partition for loader in numaker_m2l31ki.dts .
Update commit f93489d.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is slot2 the bootloader? If so, how does that code partition run first? If you are using mcuboot could you copy the naming from here: https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts#L277

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it could be mucboot or another simple bootloader.
Thanks and it's OK to use the same naming.

boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki.dts Outdated Show resolved Hide resolved
boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki.dts Outdated Show resolved Hide resolved
board_runner_args(nulink "-f")

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nulink.board.cmake)
Copy link
Member

Choose a reason for hiding this comment

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

hey just noticed this one:

$ west flash -r nulink
-- west flash: using runner nulink
FATAL ERROR: unknown runner "nulink"

Are you going to upstream this?

Copy link
Contributor Author

@cyliangtw cyliangtw Mar 20, 2024

Choose a reason for hiding this comment

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

So far, no plan and I remove this proprietary nulink runner.
Thanks & update commit d052b2b

Copy link
Member

Choose a reason for hiding this comment

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

Ok thanks for clarifying, the whole boards/common/nulink.board.cmake should probably go as well then. That said, I think it should be acceptable to keep it as long as you contribute the west runner script as well (the file in scripts/west_commands/runners, even if the binary it self is not distributed with the project. At least that's how nrfutil and nrfjprog works already (and probably more).

@cyliangtw cyliangtw force-pushed the nvt_m2l31_board branch 2 times, most recently from 48edae5 to d052b2b Compare March 20, 2024 08:09
@cyliangtw cyliangtw requested a review from nordicjm March 20, 2024 09:47
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make smaller. e.g. cwebp -q 80 m2l31ki.jpg -o m2l31ki.webp gives a file 58% of the file size here without changing resolution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The size improvement is excellent, I changed to m2l31ki.webp .

#address-cells = <1>;
#size-cells = <1>;

slot0_partition: partition@0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

My question is do these work out of the box or does someone need to build and load their own bootloader e.g. mcuboot? If this works out of the box then this can be marked as resolved, if they need e.g. mcuboot or another bootloader which they need to flash themselves then there should be a partition here for that bootloader

@cyliangtw cyliangtw force-pushed the nvt_m2l31_board branch 3 times, most recently from c343213 to 701dbf9 Compare March 20, 2024 12:32
fabiobaltieri
fabiobaltieri previously approved these changes Mar 20, 2024
specially developed by Nuvoton. The NuMaker-M2L31KI is based on the NuMicro® M2L31
series MCU with ARM® -Cortex®-M23 core.

.. image:: ./m2l31ki.jpg
Copy link
Member

Choose a reason for hiding this comment

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

/home/runner/_work/zephyr/zephyr/doc/_build/src/boards/nuvoton/numaker_m2l31ki/doc/index.rst:: WARNING: image file not readable: ../../../boards/nuvoton/numaker_m2l31ki/doc/m2l31ki.jpg

webp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's webp. Sorry forget to modify index.rst

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 58 to 65
slot0_partition: partition@8000 {
label = "image-0";
reg = <0x00008000 0x00038000>;
};
slot1_partition: partition@40000 {
label = "image-1";
reg = <0x00040000 0x0003e000>;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will not work for MCUboot, the sizes depend upon what operating mode you are going to use:

  • swap using move: images can be same size but this is inefficient, slot0 should be larger than slot1, the most efficient size can be determined by building e.g. samples/subsys/mgmt/mcumgr/smp_svr for your board using sysbuild, ensuring the the MCUboot image has logging enabled and set to debug level, then when booting checking the message that will be printed on the board that mentions about slot sizes.
  • overwrite only: images must be same size
  • XIP: images must be same size

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks your advice, I will adjust to fulfill overwrite only by tomorrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to let image 0 & image 1 same size.

Add new development board numaker_m2l31ki for m2l31x series.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
@fabiobaltieri fabiobaltieri merged commit 62665ea into zephyrproject-rtos:main Mar 21, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Nuvoton Numicro Numaker Nuvoton Technology Corporation, Numicro Numaker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants