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

[BUG] Static Char Arrays are empty for NuttX Apps compiled for rv-virt:knsh and knsh64 #15526

Closed
1 task done
lupyuen opened this issue Jan 14, 2025 · 2 comments · Fixed by #15527
Closed
1 task done
Labels
Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Applications Issues related to Applications OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working

Comments

@lupyuen
Copy link
Member

lupyuen commented Jan 14, 2025

Description / Steps to reproduce the issue

When we print a Static Char Array in a NuttX App: hello_main.c

static char test_static[] = "Testing Static Var";
int main(int argc, FAR char *argv[]) {
  printf("test_static=%s\n", test_static);
  printf("Address of test_static=%p\n", test_static);
  return 0;
}

The Static Char Array appears as Empty for rv-virt:knsh and rv-virt:knsh64:

## NuttX Source: https://github.com/apache/nuttx/tree/c94a99326ecd9dab1c56b0aaa2f0abe82148a405
## NuttX Apps: https://github.com/apache/nuttx-apps/tree/04f0b8e19274ff65ad8744d4b5b37f522c0097c0
$ qemu-system-riscv32 -semihosting -M virt,aclint=on -cpu rv32 -kernel nuttx -bios opensbi-1.5-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin -nographic
QEMU emulator version 9.2.0
OpenSBI v1.5

NuttShell (NSH) NuttX-12.8.0
nsh> hello
test_static=
Address of test_static=0xc0100200

nsh> uname -a
NuttX 12.8.0  risc-v rv-virt

rv-virt:knsh Log

rv-virt:knsh64 Log

Also note that the Commit Hash is missing for uname -a, because it uses a Static Char Array. See the discussion here:

Update: Here's how the Missing Commit Hash is linked to the Empty Static Vars:

Image

On which OS does this issue occur?

[OS: Mac]

What is the version of your OS?

macOS 15.2 24C101 arm64

NuttX Version

master

Issue Architecture

[Arch: risc-v]

Issue Area

[Area: Applications]

Verification

  • I have verified before submitting the report.
@lupyuen lupyuen added the Type: Bug Something isn't working label Jan 14, 2025
@github-actions github-actions bot added Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Applications Issues related to Applications OS: Mac Issues related to MacOS (building system, etc) labels Jan 14, 2025
@xiaoxiang781216
Copy link
Contributor

@anjiahao1 please look at this problem.

@anjiahao1
Copy link
Contributor

#15527 @lupyuen @yf13 hello, take look this pr, this is rootcuase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Applications Issues related to Applications OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants