lupyuen commented on PR #15444:
URL: https://github.com/apache/nuttx/pull/15444#issuecomment-2586160111

   Sorry again @yf13: Static Variables don't seem to work correctly for 
`rv-virt:knsh64`, wonder if there's a problem with the Linking of Static Vars?
   
   Here's the code that prints a Static Var: 
[hello_main.c](https://github.com/lupyuen2/wip-nuttx-apps/blob/uname/examples/hello/hello_main.c#L31-L57)
   ```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);
   ```
   
   `rv-virt:knsh64` shows that the Static Var is incorrectly empty: [knsh64 
Log](https://gist.github.com/lupyuen/75c326a01c5e9110cac56b6e47f1a85f#file-special-qemu-riscv-knsh64-log-L1427-L1436)
   ```text
   nsh> hello
   test_static=
   Address of test_static=0xc0100200
   ```
   
   `rv-virt:nsh64` shows that the Static Var is correctly non-empty: [nsh64 
Log](https://gist.github.com/lupyuen/28517259f7c610dc3219093eb8ddd258#file-special-qemu-riscv-nsh64-log-L600-L609)
   ```text
   nsh> hello
   test_static=Testing Static Var
   Address of test_static=0x8002d6d8
   ```
   
   This might explain why `uname -a` for `rv-virt:knsh64` doesn't print the 
Commit Hash. Thanks!
   ```text
   nsh> uname -a
   NuttX 12.8.0  risc-v rv-virt
   ```
   [knsh64 
Log](https://gist.github.com/lupyuen/75c326a01c5e9110cac56b6e47f1a85f#file-special-qemu-riscv-knsh64-log-L1392-L1393)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to