You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use the printf function within a test program, but it does not work. While debugging, I found some potential problems in the system + environment.
The address to be checked cannot be the one suggested, and cannot be the one used by the c910 core. The write of the fputc function must go to the top without stopping at the cache (so it must be in a non-cacheable region). The manual says that when virtual memory is not used, the PMA settings can be found in C906_RTL_FACTORY/gen_rtl/mmu/rtl/sysmap.h. There, we see that up to 0x8fffffff, the region is cacheable (the settings for c910 are different). Then, up to 0xbfffffff, it is not cacheable.
If we set the address to 32'h9000_0000 (both in the tb.v and in the fputc.c), printf works.
Be aware that if you want to use peripherals, either the sysmap.h or the APB rules must be changed, as it seems to me that the UART and all the other peripherals are in the cacheable region as well. So, I guess the best thing to do would be to remap the peripherals and the sysmap.h to have something consistent.
Thanks in advance for further suggestions and comments!
Matteo
The text was updated successfully, but these errors were encountered:
Hello everyone,
I tried to use the printf function within a test program, but it does not work. While debugging, I found some potential problems in the system + environment.
TL;DR:
printf
, change this address and this address to0x90000000
.Details:
biu_pad_awaddr
against32'h10015000
to find a writehttps://github.com/T-head-Semi/openc906/blob/main/smart_run/logical/tb/tb.v#L285
but the
fputc
function does not store to that address.fputc
function:https://github.com/T-head-Semi/openc906/blob/main/smart_run/tests/lib/clib/fputc.c
https://github.com/T-head-Semi/openc906/blob/main/smart_run/tests/lib/clib/printf.c
From what I see,
coremark
compiles only because the filetests/lib/newlib_wrap/clib/printf.c
is overwritten bytests/lib/newlib_wrap/printf.c
(https://github.com/T-head-Semi/openc906/blob/main/smart_run/setup/smart_cfg.mk#L59)printf
now works.fputc
function must go to the top without stopping at the cache (so it must be in a non-cacheable region). The manual says that when virtual memory is not used, the PMA settings can be found inC906_RTL_FACTORY/gen_rtl/mmu/rtl/sysmap.h
. There, we see that up to0x8fffffff
, the region is cacheable (the settings for c910 are different). Then, up to0xbfffffff
, it is not cacheable.32'h9000_0000
(both in thetb.v
and in thefputc.c
),printf
works.Be aware that if you want to use peripherals, either the
sysmap.h
or the APB rules must be changed, as it seems to me that the UART and all the other peripherals are in the cacheable region as well. So, I guess the best thing to do would be to remap the peripherals and thesysmap.h
to have something consistent.Thanks in advance for further suggestions and comments!
Matteo
The text was updated successfully, but these errors were encountered: