Skip to content

Port to STM32 #101

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

Closed
wants to merge 1 commit into from
Closed

Conversation

per42
Copy link

@per42 per42 commented May 28, 2025

Augment flash controllers with their instance on STM32.

This works on current zephyr main - e92677bd3cceb27079d7cb1e3f783d809edea362. It runs the hello world sample on nucleo_wl55jc, but fails with:

panic: panicked at library/alloc/src/alloc.rs:437:13:
memory allocation of 8 bytes failed
*** Booting Zephyr OS build v4.1.0-4886-ge92677bd3cce ***
[00:00:00.000,000] <err> os: CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE is 0
[00:00:00.008,000] <err> os: r0/a1:  0x00000004  r1/a2:  0x0000000a  r2/a3:  0x00000000
[00:00:00.008,000] <err> os: r3/a4:  0x00000004 r12/ip:  0x200022f4 r14/lr:  0x08007f5b
[00:00:00.008,000] <err> os:  xpsr:  0x21000000
[00:00:00.008,000] <err> os: Faulting instruction address (r15/pc): 0x08004e48
[00:00:00.008,000] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00:00:00.008,000] <err> os: Current thread: 0x200005e8 (unknown)
[00:00:00.025,000] <err> os: Halting system

This is easily solved with CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=4096 in prj.conf. I can add this to this pull request or separately if you prefer, but I don't know what is suitable for all samples and tests.

[00:00:00.000,000] <inf> rust: rustapp: Hello world from Rust on nucleo_wl55jc

I also tried to add this on main, but DTS parsing fails due to the parser not accepting the origin comments produced by zephyr, it seems. I assume you would like this change introduced there, and then backported.

Augment flash controllers with their instance on STM32
@d3zd3z
Copy link
Collaborator

d3zd3z commented Jun 27, 2025

Let's keep the malloc arena size change separate. If anything, we might need to figure out how to make this specific to this target. I'm not actually sure why it is needed there, the default for the arena size should be -1, which uses the rest of RAM for the heap.

Copy link
Collaborator

@d3zd3z d3zd3z left a comment

Choose a reason for hiding this comment

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

Looks good. I'll probably clean up the first line of the commit text to make it a little clearer, but the change itself looks good.

@d3zd3z
Copy link
Collaborator

d3zd3z commented Jun 27, 2025

Also, this should be on main, not on the 4.1 branch.

@d3zd3z
Copy link
Collaborator

d3zd3z commented Jun 27, 2025

It will also need a Signed-off-by from @per42.

@d3zd3z
Copy link
Collaborator

d3zd3z commented Jun 27, 2025

@per42, I've created @109 which is this change, based instead on 'main'.

@per42 per42 closed this Jun 27, 2025
@per42
Copy link
Author

per42 commented Jun 27, 2025

Also, this should be on main, not on the 4.1 branch.

Yes, #109 on master (probably since commit 1cab77b436bccf2c84678e8825b586a093da0918 ) builds and runs the sample on my board. Closed.

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

Successfully merging this pull request may close these issues.

2 participants