jasonbu opened a new pull request, #17571:
URL: https://github.com/apache/nuttx/pull/17571

   ## Summary
   The previous tz_lock not working. #ifndef __KERNEL__ means only usermode 
will run up_interrupt_context etc.
   
   Causing kernel build report undefined reference 'g_nx_initstate'
   Also protect build still ensure no access of kernel objects.
   
   ## Impact
   The code did not have effect before patch.
   After patch, will correctly skip lock when userspace or idle thread.
   
   ## Testing
   CI test, mps3-knsh
   
   enable CONFIG_LIBC_LOCALTIME in 
boards/arm/mps/mps3-an547/configs/knsh/defconfig
   
   update apps/examples/hello/hello_main.c 
   ```C
   #include <time.h>
   
   int main(int argc, FAR char *argv[])
   {
     tzset();
     printf("Hello, World!!\n");
     return 0;
   }
   ```
   
   error before patch.
   ```
   arm-none-eabi-ld: ~/nuttx/staging//libc.a(lib_localtime.o): in function 
`tz_lock':
   ~/nuttx/libs/libc/time/lib_localtime.c:396:(.text.tz_lock+0x12): undefined 
reference to `sched_idletask'
   arm-none-eabi-ld: 
~/nuttx/libs/libc/time/lib_localtime.c:403:(.text.tz_lock+0x38): undefined 
reference to `g_nx_initstate'
   arm-none-eabi-ld: ~/nuttx/staging//libc.a(lib_localtime.o): in function 
`tz_unlock':
   ~/nuttx/libs/libc/time/lib_localtime.c:408:(.text.tz_unlock+0x12): undefined 
reference to `sched_idletask'
   arm-none-eabi-ld: 
~/nuttx/libs/libc/time/lib_localtime.c:415:(.text.tz_unlock+0x38): undefined 
reference to `g_nx_initstate'
   make[1]: *** [Makefile:61: nuttx_user.elf] Error 1
   ```
   
   fixed after patch. we able to call function tzset in hello.


-- 
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