10000 On Jolt.js/Puck.js, add option to run the self-test the very first ti… · espruino/Espruino@1ca8483 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ca8483

Browse files
committed
On Jolt.js/Puck.js, add option to run the self-test the very first time the board boots up, default to off
2v26 and earlier full hex files would run the self-test at boot (DFU update builds don't)
1 parent ce38983 commit 1ca8483

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

README_BuildProcess.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ This is a partial list of definitions that can be added in a `BOARD.py` file's `
152152
* `ESPR_BLE_PRIVATE_ADDRESS_SUPPORT` - NRF52: Enable support for using a random private BLE address, that automatically changes at a set interval. See the `privacy` option that can be passed to `NRF.setSecurity()`.
153153
* `ESPR_FS_MKFS` - Add support for require("fs").mkfs for formatting disks
154154
* `ESPR_FS_GETFREE` - Add support for require("fs").getFree in the filesystem library
155+
* `ESPR_TEST_ON_FIRST_RUN` - on Jolt.js/Puck.js, run the self-test the very first time the board boots up (this is not the default since 2v27)
155156

156157

157158
There are some specifically that are useful for cutting a few bytes out of the build:

libs/joltjs/jswrap_jolt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ void jswrap_jolt_init() {
606606
package don't do that as the device might be connected to something which will
607607
make the test keep failing. */
608608
bool firstRunAfterFlash = false;
609-
#ifndef DFU_UPDATE_BUILD
609+
#ifdef ESPR_TEST_ON_FIRST_RUN
610610
uint32_t firstStartFlagAddr = FLASH_SAVED_CODE_START-4;
611611
if (firstStart) {
612612
// check the 4 bytes *right before* our saved code. If these are 0xFFFFFFFF
@@ -624,7 +624,7 @@ void jswrap_jolt_init() {
624624
// if we're doing our first run after being flashed with new firmware, we set the advertising name
625625
// up to say PASS or FAIL, to work with the factory test process.
626626
bool result = _jswrap_jolt_selfTest(firstRunAfterFlash);
627-
#ifndef DFU_UPDATE_BUILD
627+
#ifdef ESPR_TEST_ON_FIRST_RUN
628628
// if we passed, set the flag in flash so we don't self-test again
629629
if (firstRunAfterFlash && result) {
630630
uint32_t buf = 0;

libs/puckjs/jswrap_puck.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ void jswrap_puck_init() {
17381738
package don't do that as the device might be connected to something which will
17391739
make the test keep failing. */
17401740
bool firstRunAfterFlash = false;
1741-
#ifndef DFU_UPDATE_BUILD
1741+
#ifdef ESPR_TEST_ON_FIRST_RUN
17421742
uint32_t firstStartFlagAddr = FLASH_SAVED_CODE_START-4;
17431743
if (firstStart) {
17441744
// check the 4 bytes *right before* our saved code. If these are 0xFFFFFFFF
@@ -1755,7 +1755,7 @@ void jswrap_puck_init() {
17551755
// if we're doing our first run after being flashed with new firmware, we set the advertising name
17561756
// up to say PASS or FAIL, to work with the factory test process.
17571757
bool result = _jswrap_puck_selfTest(firstRunAfterFlash);
1758-
#ifndef DFU_UPDATE_BUILD
1758+
#ifdef ESPR_TEST_ON_FIRST_RUN
17591759
// if we passed, set the flag in flash so we don't self-test again
17601760
if (firstRunAfterFlash && result) {
17611761
uint32_t buf = 0;

0 commit comments

Comments
 (0)
0