Skip to content

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

@lupyuen

Description

@lupyuen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arch: risc-vIssues related to the RISC-V (32-bit or 64-bit) architectureArea: ApplicationsIssues related to ApplicationsOS: MacIssues related to MacOS (building system, etc)Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions