JianyuWang0623 opened a new pull request, #3751:
URL: https://github.com/apache/nuttx-apps/pull/3751
## Summary
- Add support for compound command execution in init.rc action bodies (`&&`
/ `||` short-circuit semantics), e.g.:
```
echo "start" && hello && echo "done"
ls /missing || echo "not found"
```
- Add built-in property `sys.boot.reason` so action triggers can fire based
on the board's reset cause, e.g.:
```
on property:sys.boot.reason=cpu_soft_reset(bootloader)
echo "bootloader mode ..."
start fastboot
```
- Add subreason support for `sys.boot.reason` to allow finer-grained
matching, e.g.:
```
on init && property:sys.boot.reason=watchdog,4
on init && property:sys.boot.reason=bootloader|recovery|thermal
```
- Fix a missing `"assert"` entry in the `resetflag[]` designated-initializer
array that could lead to a NULL pointer dereference when accessing `reset.flag`.
## Impact
- No impact on existing behavior when these features are unused.
- `action.c`/`action.h`: `init_action_reap_command()` signature gained a
second parameter to propagate the command's return value for `&&`/`||`
short-circuiting.
## Testing
Build Host: Linux x86_64 (Ubuntu, kernel 6.8.0), gcc (Ubuntu
13.4.0-6ubuntu1~22~ppa2) 13.4.0
Target: sim:nsh (apps/system/nxinit is architecture-independent; verified
via the host simulator since no esp32p4 riscv32 cross toolchain is available on
this machine)
Build (excerpt, `CONFIG_SYSTEM_NXINIT=y`):
```
Register: init
CC: action.c
CC: init.c
CC: parser.c
CC: builtin.c
CC: import.c
CC: service.c
CC: property_simple.c
IN: /.../apps/libapps.a -> staging/libapps.a
LD: nuttx
Pac SIM with dynamic libs..
SIM elf with dynamic libs archive in nuttx.tgz
```
Runtime (`./nuttx`, actual console output):
```
NuttShell (NSH) NuttX-13.0.1-RC0
nsh> ps
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK COMMAND
0 0 0 0 FIFO Kthread - Ready
0000000000000000 0069584 Idle_Task
1 0 0 224 FIFO Kthread - Waiting Semaphore
0000000000000000 0067448 sim_loop_wq 0x72f7d6c003f0 0x72f7d6c00470
2 0 0 224 FIFO Kthread - Waiting Semaphore
0000000000000000 0067472 hpwork 0x40167dc0 0x40167e40
4 4 0 100 FIFO Task - Running
0000000000000000 0067504 nsh_main
nsh> exit
```
Style check (`tools/checkpatch.sh -g
apache/master..nxinit-action-trigger-enhancements`, actual output):
```
/tmp/.../apps/system/nxinit/action.c:117:4: error: Bad left brace alignment
Some checks failed. For contributing guidelines, see:
https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md
```
The single reported issue (`action.c:117`) is pre-existing on
`apache/master` — reproduced by running `nxstyle` directly against the
unmodified `apache/master` copy of `action.c`, which reports the identical
error at the same line. It is not introduced by this change.
Not verified: esp32p4/esp32s3 board-level flashing and serial output — this
change is architecture-independent apps-layer code, and this machine has no
esp32p4 riscv32 cross toolchain installed.
--
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]