Skip to content

board: scobc-a1: add automatic power cycle after flashing#1

Draft
moonlight83340 wants to merge 1 commit into
spacecubics:support-west-flash-to-norfrom
moonlight83340:support-west-flash-to-nor-itcm-bootloader
Draft

board: scobc-a1: add automatic power cycle after flashing#1
moonlight83340 wants to merge 1 commit into
spacecubics:support-west-flash-to-norfrom
moonlight83340:support-west-flash-to-nor-itcm-bootloader

Conversation

@moonlight83340

Copy link
Copy Markdown
Member

Add trigger_board_power_cycle procedure in OpenOCD config to request a power cycle via the TRCH power cycle register (0x4F000020) after programming.

This ensures the bootloader reloads the newly flashed application into RAM.

The procedure ends with an explicit shutdown to avoid the mandatory reset run issued by Zephyr’s OpenOCD runner after the cmd-post-verify hook. Without this, OpenOCD would attempt to reset a disconnected board during reboot, which leads to errors.

The function is hooked as --cmd-post-verify in the board’s .board.cmake, so it runs automatically after west flash but not during west debug.

Add `trigger_board_power_cycle` procedure in OpenOCD config to
request a power cycle via the TRCH power cycle register (0x4F000020)
after programming.

This ensures the bootloader reloads the newly flashed application
into RAM.

The procedure ends with an explicit `shutdown` to avoid the
mandatory `reset run` issued by Zephyr’s OpenOCD runner after the
`cmd-post-verify` hook. Without this, OpenOCD would attempt to reset
a disconnected board during reboot, which leads to errors.

The function is hooked as `--cmd-post-verify` in the board’s
`.board.cmake`, so it runs automatically after `west flash` but not
during `west debug`.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
@moonlight83340 moonlight83340 marked this pull request as ready for review September 17, 2025 05:56
sasataku pushed a commit that referenced this pull request Jan 9, 2026
Per RFC9112 (REF #1), HTTP/1.1 server is expected to be backward
compatible with HTTP1.0 request. Mainly HTTP/1.0 does
not support
1) Transfer Encoding : chunked
2) KeepAlives

So, this change will identify the HTTP protocol
version in the request and respond accordingly.

REF#
1) https://httpwg.org/specs/rfc9112.html

Tested:
1) Verified that HTTP/1.1 requests are served as usual
i.e. with chunked transfer encoding and the connection
is a Keep Alive connection

Query exits after 10s, indicating that the client connection to
the HTTP server is a Keep Alive.

```
time printf "GET /telem HTTP/1.1\r\nHost: 192.0.3.11\r\n\r\n" |
    nc 192.0.3.11 80

real    0m10.185s  <- Indicates connection was kept active for 10s
user    0m0.023s
sys     0m0.023s
```

`Transfer Encoding :  chunked` header and chunked encoding
metadata (chunk size hex bytes, crlf, termination byte 0)
are present in the response.

```
HTTP/1.1 200 OK
Transfer-Encoding: chunked <- Chunked encoding header
Content-Type: text/html

3e8 <- Chunk size hex bytes

:
/health/secondsdevice_ae:9a:22:48:0f:70"seconds0
+
/health/locatedevice_ae:9a:22:48:0f:70"0
/
/network/mac-addressdevice_ae:9a:22:48:0f:70"
.
.
.

3e8 <- Chunk size hex byte
_PLUS_rawdevice_ae:9a:22:48:0f:70"0
6
/dev/ISHARE_CBU_MINUS_rawdevice_ae:9a:22:48:0f:70"0
.
.
.
/dev/part_iddevice_ae:9a:22:48:0f:70"0���������
,
/dev/part_typedevice_ae:9a:22:48:0f:70"0
7
/dev/part_telemetry_disabledevice_ae:9a:22:48:0f:70"0
0 <- Termination Byte 0
```

2) Verfied that HTTP/1.0 requests are served with
response without chunked transfer encoding and the
connection is closed immediately.

Query exits immediately indicating the connection is closed immediately

```
time printf "GET /telem HTTP/1.0\r\nHost: 192.0.3.11\r\n\r\n" |
    nc 192.0.3.11 80

real    0m0.186s <- Indicates connection was terminated immediately.
user    0m0.018s
sys     0m0.030s

```

`Transfer Encoding : chunked` header and chunked encoding
metadata (chunk size hex bytes, crlf) not present in the
response

```
HTTP/1.1 200 OK
Content-Type: text/html

:
/health/uptimedevice_ae:9a:22:48:0f:70"seconds0
+
/health/locatedevice_ae:9a:22:48:0f:70"0
/
/network/mac-addressdevice_ae:9a:22:48:0f:70"
.
.
.
3

/dev/part_iddevice_ae:9a:22:48:0f:70"0���������
,
/dev/part_typedevice_ae:9a:22:48:0f:70"0
7
/dev/can_telemetry_disabledevice_ae:9a:22:48:0f:70"0
```

Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
@sasataku sasataku marked this pull request as draft May 12, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants