Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save neuberfran/c9750cb00db6b3e66c53098f764f893e to your computer and use it in GitHub Desktop.
Save neuberfran/c9750cb00db6b3e66c53098f764f893e to your computer and use it in GitHub Desktop.
Howw to solve Pls
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map
: && ccache /home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/lib/posix/options/liblib__posix__options.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/ipm/libdrivers__ipm.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/hal_nxp/hal_nxp/lib..__modules__hal__nxp.a modules/libmetal/libmetal/lib/libmetal.a modules/open-amp/open-amp/lib/libopen_amp.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -L/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_LONG_LONG_PRINTF_SCANF --specs=picolibc.specs -lc -lgcc && cd /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr && /usr/bin/cmake -E true
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: warning: orphan section `.resource_table' from `zephyr/libzephyr.a(resource_table.c.obj)' being placed in section `.resource_table'
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section datas VMA [0000000020000000,00000000200000fb] overlaps section text VMA [000000001fff8240,0000000020000e17]
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section .ARM.exidx VMA [0000000020000e18,0000000020000e1f] overlaps section bss VMA [0000000020000160,00000000200012ea]
Expandir
message.txt
5 KB
josuah — 25/05/2024 12:38
One reason for having "flash overflowed by xxx bytes" is that there is not enough storage in the chip to add all the features wanted
The shell can add a lot of functionalities at once, so you might need to reduce the application or system size first
One way to troubleshoot this would be looking at the .map file (apparently here /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map)
This shows the list of all symbols shown and their size
Some tool to build a report of the flash ("rom"): https://docs.zephyrproject.org/latest/develop/optimizations/tools.html#build-target-rom-report
neuberfran — 25/05/2024 13:13
@josuah https://devzone.nordicsemi.com/f/nordic-q-a/109698/adding-config_log-y-causes-flash-overflow-error
Adding CONFIG_LOG=y causes Flash overflow error - Nordic Q&A - Nord...
This is my environment
IDE: VSC
SDK: NCS v2.2.0
nRF52-DK
I've got a couple of different sets of firmware for different applications, and I am seeing
josuah — 25/05/2024 13:14
Oh right, logging often brings a lot of code in
With all the debug strings...
neuberfran — 25/05/2024 13:14
I'm making some attempts here. I already had a similar problem (when I put CONFIG_LOG=y, etc.) which was resolved just with the suggestions in the link above. This time, it's more complicated.
@josuah my zephyr_pre0.map is
https://gist.github.com/neuberfran/1c3762000d3a5194f9a49cc2b5f6d3ca
Gist
zephyr_pre0.map
zephyr_pre0.map. GitHub Gist: instantly share code, notes, and snippets.
zephyr_pre0.map
josuah — 25/05/2024 13:20
This board? https://www.technexion.com/products/system-on-modules/pico/pico-imx7/
TechNexion
TechNexion - PICO-IMX7
NXP i.MX7 System-on-Module Cortex-A7 Low-Power PICO SOM with Yocto, Linux, Android Source code
TechNexion - PICO-IMX7
josuah — 25/05/2024 13:23
I discovered the ROM size debug target just now, maybe it will be even more readable
Could you try west build -t rom_report?
josuah — 25/05/2024 13:39
Maybe, but still less complicated than getting OpenAMP to work I believe. As it is not about a bug, but just about resource limitation, so a compromise and a bit of tuning later, we might get there...
There are examples on how to reduce the footprint further: https://docs.zephyrproject.org/latest/samples/basic/minimal/README.html
neuberfran — 25/05/2024 13:41
west build -t rom_report
-- west build: running target rom_report
[1/7] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map
: && ccache /home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/lib/posix/options/liblib__posix__options.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/ipm/libdrivers__ipm.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/hal_nxp/hal_nxp/lib..__modules__hal__nxp.a modules/libmetal/libmetal/lib/libmetal.a modules/open-amp/open-amp/lib/libopen_amp.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -L/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_LONG_LONG_PRINTF_SCANF --specs=picolibc.specs -lc -lgcc && cd /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr && /usr/bin/cmake -E true
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: warning: orphan section `.resource_table' from `zephyr/libzephyr.a(resource_table.c.obj)' being placed in section `.resource_table'
Expandir
message.txt
5 KB
neuberfran — 25/05/2024 13:41
Yes
josuah — 25/05/2024 13:41
https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/basic/minimal
josuah — 25/05/2024 13:43
Ah! It wants a successful build to show the footprint, and we need the footprint for making a successful build 😆
neuberfran — 25/05/2024 13:43
https://github.com/zephyrproject-rtos/zephyr/issues/69433#issuecomment-2016598955
Imagem
GitHub
openamp_rsc_table App in imx7d-pico (M4-Side name in Zephyr=pico_pi...
Hi, https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/ipc/openamp_rsc_table#id6 I stay trying this since last month in my imx7d-pico (m4 side) Zephyr upstream board is pico_pi_m...
openamp_rsc_table App in imx7d-pico (M4-Side name in Zephyr=pico_pi...
josuah — 25/05/2024 13:44
Yes I read that one 🙂
So let's start disabling features one by one until this fits...
neuberfran — 25/05/2024 13:45
Then I intend to read this. But for now, what can I do to resolve my issue? Since I posted a link above, my friend managed to do what I'm wanting on an imx7d similar to mine
josuah — 25/05/2024 13:45
How about removing the shell (Kconfig) and then running -t rom_report again ?
josuah — 25/05/2024 13:45
Ugh! You look seriously time constrained here!
If you go back to a working build, it will be possible to get a working rom_report, and we can already start working on reducing that
And then once we removed plenty of ROM usage, we can try to see if that fits again?
neuberfran — 25/05/2024 13:47
Where exactly is the kconfig that I should delete for testing?
josuah — 25/05/2024 13:47
Those you told us to be causing the failure: ⁠general⁠
CONFIG_SHELL=n
CONFIG_SHELL_BACKEND_RPMSG=n
Then we can get a working Zephyr image, and start reducing the code size enough.
neuberfran — 25/05/2024 13:49
I'm sure that apart from these two items the build works
josuah — 25/05/2024 13:50
Perfect! Then we can use that working build to get our working rom_report...
And see what else we can turn off in Kconfig =n to get a smaller build.
I mean, we could inspect the .map file too... but I am a bit lazy on week-ends. 😛
neuberfran — 25/05/2024 13:53
https://gist.github.com/neuberfran/21c4c5e94479fc116e5b93f550867b32
Gist
neww zephyr_pre0.map
GitHub Gist: instantly share code, notes, and snippets.
neww zephyr_pre0.map
josuah — 25/05/2024 13:53
Also, it can help to work from a known working configuration: it allows us to keep checking if things still work
Thanks, now we got the new .map file... Is west build -t rom_report also working this time?
neuberfran — 25/05/2024 13:54
Ok. Wait Pls. I will do west cmd now
west build -t rom_report
-- west build: running target rom_report
[0/1] cd /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table && /usr/bin/py...t/zephyr/build/openamp_rsc_table --workspace=/home/neuberfran/zephyrproject -d 99 rom
Traceback (most recent call last):
File "/home/neuberfran/zephyrproject/zephyr/scripts/footprint/size_report", line 26, in <module>
from anytree import RenderTree, NodeMixin, findall_by_attr
ModuleNotFoundError: No module named 'anytree'
FAILED: zephyr/cmake/reports/CMakeFiles/rom_report /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/cmake/reports/CMakeFiles/rom_report
cd /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table && /usr/bin/python /home/neuberfran/zephyrproject/zephyr/scripts/footprint/size_report -k /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_openamp_rsc_table.elf -z /home/neuberfran/zephyrproject/zephyr -o /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table --workspace=/home/neuberfran/zephyrproject -d 99 rom
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table --target rom_report
neuberfran@neuberfran2204:~/zephyrproject/zephyr/build/openamp_rsc_table$
josuah — 25/05/2024 13:55
I am not flying away any time soon.
When you find some error message looking like ModuleNotFoundError: No module named '...' this means you would are missing a python package.
You can install it with pip
neuberfran — 25/05/2024 13:58
west build -t rom_report
-- west build: running target rom_report
[0/1] cd /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table && /usr/bin/py...t/zephyr/build/openamp_rsc_table --workspace=/home/neuberfran/zephyrproject -d 99 rom
WARN: Symbol 'z_tls_current' section '' is not in RAM or ROM.
Path Size % Address Section
==========================================================================================================================================... (8 KB restante(s))
Expandir
message.txt
58 KB
josuah — 25/05/2024 13:58
Nice!
Here are a few things that take quite a bit of size:
This for printing log messages: +6% in size
│ ├── __l_vfprintf 1208 6.11% 0x1fffa945 text
neuberfran — 25/05/2024 14:00
@josuah Do I need to delete this?
josuah — 25/05/2024 14:00
RPMSG also brings 10% of ROM size:
│ ├── rpmsg 2004 10.14% -
Which is used as a shell back-end.
The Scheduler is taking 8%, and it is a very central system feature but it might be possible to reduce its footprint
│ ├── sched.c 1670 8.45% -
The "heap", used by malloc(), is taking a bit of room too:
│ │ ├── heap.c 908 4.60% -
Interestingly, main.c of the sample also takes a good 5%:
│ └── main_remote.c 1102 5.58% -
neuberfran — 25/05/2024 14:03
I will post my *.conf (pico_pi_m4.conf and prj.conf) and please, could you tell me what should be changed?
I imagine I can't touch anything about RPMsg as it is the heart of OpenAMP
josuah — 25/05/2024 14:04
So this means we are almost full before adding the shell: we would need to save a lot more room to allow a shell to fit.
josuah — 25/05/2024 14:05
Sounds like so: you might need a very small build here.
neuberfran — 25/05/2024 14:05
prj.conf
CONFIG_KERNEL_BIN_NAME="zephyr_openamp_rsc_table"
CONFIG_PRINTK=n
CONFIG_IPM=y
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_HEAP_MEM_POOL_SIZE=1024
CONFIG_OPENAMP=y
CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=32
CONFIG_OPENAMP_RSC_TABLE=y
CONFIG_OPENAMP_MASTER=n
CONFIG_SHELL=n
CONFIG_SHELL_BACKEND_RPMSG=n
pico_pi_m4.conf
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CONSOLE=y
CONFIG_LOG_PRINTK=y
CONFIG_IPM_IMX_MAX_DATA_SIZE_16=n
CONFIG_IPM_IMX_MAX_DATA_SIZE_4=y
CONFIG_OPENAMP_WITH_DCACHE=y
josuah — 25/05/2024 14:09
It looks like most/all logs were disabled. Maybe you can disable logs globally? CONFIG_LOG=n
Maybe that would remove printf
Also, a lot of debug strings removed from each and every modules thanks to this.
And since there is no log, it might even be possible to remove the UART altogether.
CONFIG_SERIAL=n and CONFIG_UART_CONSOLE=n and remove CONFIG_LOG_PRINTK=y
Then, we can add Kconfig parameters to remove further features
neuberfran — 25/05/2024 14:14
? Sorry. I don`t understood this part
josuah — 25/05/2024 14:17
Let me find this on the basic/minimal sample...
https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/basic/minimal/common.conf
GitHub
zephyr/samples/basic/minimal/common.conf at main · zephyrproject-rt...
Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures. - zephyrproject-rtos/zephyr
zephyr/samples/basic/minimal/common.conf at main · zephyrproject-rt...
I think you can go ahead and try to import all of that
At least for a short test
For instance under a # Size optimization from samples/basic/minimal/common.conf comment
And then run a report again
neuberfran — 25/05/2024 14:20
Not Solved Yet Here
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map
: && ccache /home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/lib/posix/options/liblib__posix__options.a zephyr/drivers/ipm/libdrivers__ipm.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/hal_nxp/hal_nxp/lib..__modules__hal__nxp.a modules/libmetal/libmetal/lib/libmetal.a modules/open-amp/open-amp/lib/libopen_amp.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -L/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_LONG_LONG_PRINTF_SCANF --specs=picolibc.specs -lc -lgcc && cd /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr && /usr/bin/cmake -E true
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: warning: orphan section `.resource_table' from `zephyr/libzephyr.a(resource_table.c.obj)' being placed in section `.resource_table'
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section datas VMA [0000000020000000,00000000200000eb] overlaps section text VMA [000000001fff8240,0000000020000d73]
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section .ARM.exidx VMA [0000000020000d74,0000000020000d7b] overlaps section bss VMA [0000000020000150,00000000200012d6]
Expandir
message.txt
5 KB
josuah — 25/05/2024 14:24
Before: region 'FLASH' overflowed by 11124 bytes
After: region 'FLASH' overflowed by 10920 bytes
That barely helped...
Could you run the rom_report again?
neuberfran — 25/05/2024 14:25
Ok
josuah — 25/05/2024 14:25
Then we would be able to see if these things are still there: ⁠Howw to solve Pls⁠
neuberfran — 25/05/2024 14:26
https://gist.github.com/neuberfran/c2e31ab7641f84a478a56b1d47ddf6e9
Gist
result
GitHub Gist: instantly share code, notes, and snippets.
result
neuberfran — 25/05/2024 14:27
Sure. Ok. Tks
Ok
josuah — 25/05/2024 14:28
Ah, right, you might need to turn off the shell again:
CONFIG_SHELL=n
CONFIG_SHELL_BACKEND_RPMSG=n
The goal here is to reduce the build size by 10920 bytes.
If we can do that, then after this we know the shell would fit.
neuberfran — 25/05/2024 14:29
Ok
https://gist.github.com/neuberfran/abfd7bd505b2bd620e695fe3c2afb132
Imagem
Gist
result2
GitHub Gist: instantly share code, notes, and snippets.
result2
josuah — 25/05/2024 14:38
Well, printf is still there... Hard to do without it when using the shell anyway!
│ ├── __l_vfprintf 1208 6.82% 0x1fffa4fd text
neuberfran — 25/05/2024 14:39
while (tty_ept.addr != RPMSG_ADDR_ANY) {
k_sem_take(&data_tty_sem, K_FOREVER);
if (tty_msg.len) {
LOG_INF("[Linux TTY] incoming msg: %.s",
tty_msg.len, (char)tty_msg.data);
// snprintf(tx_buff, 13, "TTY 0x%04x: ", tty_ept.addr);
memcpy(&tx_buff[12], tty_msg.data, tty_msg.len);
rpmsg_send(&tty_ept, tx_buff, tty_msg.len + 12);
rpmsg_release_rx_buffer(&tty_ept, tty_msg.data);
}
tty_msg.len = 0;
tty_msg.data = NULL;
}
josuah — 25/05/2024 14:41
That could be the application too good point
neuberfran — 25/05/2024 14:41
(// snprintf(tx_buff, 13, "TTY 0x%04x: ", tty_ept.addr); I had already commented on this line before, maybe that's what it's about?
josuah — 25/05/2024 15:46
There are other printf() used all the way through Zephyr too...
And we will need printf() as it is used by the shell I think.
So maybe the next step is to remove whole parts of the kernel.
🪚
CONFIG_MULTITHREADING=n
CONFIG_KERNEL_MEM_POOL=n
CONFIG_SYS_CLOCK_EXISTS=n
CONFIG_NUM_PREEMPT_PRIORITIES=0
neuberfran — 25/05/2024 16:44
@josuah Not solved Unfortunately
josuah — 25/05/2024 16:48
How much ROM usage this time? 🙂
neuberfran — 25/05/2024 16:54
If I put these 4 lines I get the error below, even disabling everything about the shell
https://gist.github.com/neuberfran/684a1a59079a163dc5d964505d7421d8
Gist
issue02
GitHub Gist: instantly share code, notes, and snippets.
issue02
josuah — 25/05/2024 17:39
We turned off too many things 😅
neuberfran — 25/05/2024 18:14
Yes, Maybe I can try OCRAM and NOT TCML. I prefer TCML
Imagem
josuah — 26/05/2024 17:55
Oh, so it runs from RAM?
That explains the small amount of storage for the code.
Testing with OCRAM would be a good way to move forward if that is not used by the Linux core.
Or the DDR... It depends on the speed it needs maybe... And that might be used for other things by Linux. That is a hefty amount!
Maybe there are non-Zephyr samples for that SoC, so that you can see how it is typically used.
neuberfran — 26/05/2024 19:49
https://github.com/zephyrproject-rtos/zephyr/issues/69433#issuecomment-2016601430
Imagem
GitHub
openamp_rsc_table App in imx7d-pico (M4-Side name in Zephyr=pico_pi...
Hi, https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/ipc/openamp_rsc_table#id6 I stay trying this since last month in my imx7d-pico (m4 side) Zephyr upstream board is pico_pi_m...
openamp_rsc_table App in imx7d-pico (M4-Side name in Zephyr=pico_pi...
neuberfran — 26/05/2024 19:55
I sincerely do not know
josuah — 26/05/2024 19:58
The way to have an overview of how a device is structured is to look at the devicetree, that might apply for where the code is loaded
neuberfran — 26/05/2024 20:10
I'll have to change this below and in Uboot it will no longer be 0x7f80000. Last time I tried this (a month ago) I got kernel panic
chosen {
zephyr,flash = &tcml_code;
// &ocram_code;
// &tcml_code;
zephyr,sram = &tcmu_sys;
zephyr,console = &uart6;
zephyr,shell-uart = &uart6;
};
https://gist.github.com/neuberfran/91ab7c94cebcee9a1a22f2c030c6a98d
Gist
pico_pi_m4.dts
GitHub Gist: instantly share code, notes, and snippets.
pico_pi_m4.dts
josuah — 26/05/2024 20:17
Oh uboot for Zephyr too?
I thought the main CPU was booting Zephyr, but apparently different devices have different strategies...
It is called zephyr,flash, but in this case the "flash" is a block of RAM...
Maybe the ocram_code is used by Linux too 🤔
Now maybe we can compare with Linux or U-Boot devicetrees.
This will be roughly the same syntax for us to investigate
https://github.com/u-boot/u-boot/tree/master/board/technexion/pico-imx7d
josuah — 26/05/2024 20:27
which brings us here: https://github.com/u-boot/u-boot/blob/a7f0154c412859323396111dd0c09dbafbc153cb/dts/upstream/src/arm/nxp/imx/imx7s.dtsi#L186
Ah, no, IMX7D, not IMX7S
(Dual-core, not Single-core)
https://github.com/u-boot/u-boot/blob/a7f0154c412859323396111dd0c09dbafbc153cb/dts/upstream/src/arm/nxp/imx/imx7d-pico.dtsi#L7C11-L7C21
https://github.com/u-boot/u-boot/blob/a7f0154c412859323396111dd0c09dbafbc153cb/dts/upstream/src/arm/nxp/imx/imx7d.dtsi#L6
oh, ok, so we are back to the IMX7S
https://github.com/u-boot/u-boot/blob/a7f0154c412859323396111dd0c09dbafbc153cb/dts/upstream/src/arm/nxp/imx/imx7s.dtsi#L186-L193
Ooh, TechNexion uses FreeRTOS!
So it's possible to look how they did to get enough RAM to boot it...
josuah — 26/05/2024 20:34
https://github.com/TechNexion/freertos-tn
No devicetrees though...
AH, nevermind, it is for the i.MX 8M, not the i.MX 7M...
Although: https://github.com/TechNexion/freertos-tn/issues/4 also running short of RAM in their case
Oh, I know: ask advise to ⁠nxp ! Here is ⁠general and on Sunday... nobody active there. You could wait Monday and ask some advises
with this picture: Screenshot_from_2024-05-25_18-12-22.png
saying you try to fit the Zephyr shell and that you run out of flash
a link to this thread and the original issue (optional)
Imagem
While they might not give the step-by-step solution, they sure understand NXP hardware very well. 🙂
And could say "Zephyr is expected to fit here, and you can give this RAM to Linux, and use this RAM to u-boot", for instance
It is still possible to try a combination of these options: ⁠Howw to solve Pls⁠
Remove most things, but not everything, depending on what is required for booting the shell...
neuberfran — 26/05/2024 22:17
Yes. If you look in detail at my video(https://www.youtube.com/watch?v=V06RC2G_3M8&t=10s), zephyr.bin is started in uboot and zephyr.elf in remoteproc(rproc). Using OCRAM, I think I have to always (and only) start in rproc after Linux boot
YouTube
Neuber Sousa
OpenAMP/RemoteProc/RPMsg in imx7d-pico 1gb using Yocto and Zephyr U...
Imagem
josuah — 26/05/2024 22:27
Thank you, good teachings for me!
neuberfran — 26/05/2024 22:30
@josuah https://github.com/zephyrproject-rtos/zephyr/discussions/71617
GitHub
imx7d/imx6d rom_start section relocation for proper remoteproc firm...
@DerekSnell @JiafeiPan To follow our discussion on Discord :-) I would like to discuss the fact that IMX7D and IMX6 need the bootvector aka sp/pc to be located into the OCRAM_S area for proper boot...
imx7d/imx6d rom_start section relocation for proper remoteproc firm...
josuah — 26/05/2024 22:30
I would like to discuss the fact that IMX7D and IMX6 need the bootvector aka sp/pc to be located into the OCRAM_S area for proper booting using remoteproc.
neuberfran — 26/05/2024 22:35
@josuah I'm almost certain that using TCML this PR was completely unnecessary for me. Now that I'm thinking about using OCRAM (to have minicom -D /dev/ttyRPMSG0 in the future, within the Linux/Yocto terminal/cli) I think I'll have to pay attention to this PR
neuberfran — 28/05/2024 13:36
The issue was converted into a conversation:
https://github.com/zephyrproject-rtos/zephyr/discussions/73424
}
GitHub
After enabling CONFIG_SHELL=y And CONFIG_SHELL_BACKEND_RPMSG=y in p...
Hi, I stay trying this: https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/ipc/openamp_rsc_table in my imx7d-pico (m4 side, board in zephyr = pico_pi_m4) #69433 (comment) https:/...
After enabling CONFIG_SHELL=y And CONFIG_SHELL_BACKEND_RPMSG=y in p...
josuah — 28/05/2024 13:38
I did not know Github could do that
Convenient.
neuberfran — 28/05/2024 16:15
@josuah He said: "(Take a look at your generated autoconf.h file to look at some buffers. Or you need to enlarge the flash region."
neuberfran — 28/05/2024 16:27
Sorry. Now I found autoconf.h
josuah — 28/05/2024 16:30
Either reducing what is on the firwmare, either picking a larger flash region is the way here!
neuberfran — 28/05/2024 16:35
@josuah https://gist.github.com/neuberfran/42abe6efe623570ae90f223432258686
Here are my autoconf.h found after the build (even though the build gave an error)
Gist
two autoconf_h Here
GitHub Gist: instantly share code, notes, and snippets.
two autoconf_h Here
@josuah Do U understood about: " to look at some buffers"?
josuah — 28/05/2024 16:36
May I ask where you had this picture from? 🙂 Screenshot_from_2024-05-25_18-12-22.png
Imagem
neuberfran — 28/05/2024 16:37
https://docs.zephyrproject.org/latest/boards/technexion/pico_pi/doc/index.html
josuah — 28/05/2024 16:46
Thank you perfect!
neuberfran — 28/05/2024 17:15
?
josuah — 28/05/2024 17:16
Ah I missed the question at the bottom.
Ah, bingo: #define CONFIG_SHELL_HISTORY_BUFFER 512
I think he meant "look at some buffer size configuration"
#define CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE 8
#define CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE 64
Things like these.
But it looks like you are out of ROM, even though the back-end for this ROM is the internal SRAM... it is still used as if it was Flash (which the board does not have for the M4)
neuberfran — 28/05/2024 18:36
@josuah I know you are already helping a lot, but I would like you to study these PRs from this user Zephyr (who also uses imx7d and m4 Zephyr) mainly because (just give control-F and search for U-boot) he uses OCRAM and this (according to it) makes it impossible to use zephyr.bin in U-boot. This user was able to build using shell and shell_backend_rpmsg
https://github.com/zephyrproject-rtos/zephyr/discussions/71617
https://github.com/zephyrproject-rtos/zephyr/pull/71684
https://github.com/zephyrproject-rtos/zephyr/pull/72970
GitHub
imx7d/imx6d rom_start section relocation for proper remoteproc firm...
@DerekSnell @JiafeiPan To follow our discussion on Discord :-) I would like to discuss the fact that IMX7D and IMX6 need the bootvector aka sp/pc to be located into the OCRAM_S area for proper boot...
imx7d/imx6d rom_start section relocation for proper remoteproc firm...
GitHub
arch: arm: rom_start relocation configuration by jlh-makeen · Pull ...
In order to support Linux rproc loading, some SOCs require the boot-vector and irq-vectors to be placed into a defined memory area for the mcu to boot.
This is necessary for NXP's IMX SOCs for ...
arch: arm: rom_start relocation configuration by jlh-makeen · Pull ...
GitHub
sample: openamp_rsc_table: enable colibri imx7d by jlh-makeen · Pul...
Following PR #71684 we can now properly boot the M4 core on IMX7D using Linux RPROC.
Adds prompts to the PR #71684 config flags so they can be used in the board's config files.
Adds the necessa...
sample: openamp_rsc_table: enable colibri imx7d by jlh-makeen · Pul...
josuah — 28/05/2024 18:42
The reason for my silence is not that I am not interested, but rather that I need to meet deadlines on my end too 😬
josuah — 28/05/2024 19:40
Maybe you could look at how much of you RAM is currently used to store the code... Maybe not the whole RAM region is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment