<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/supervisor/shared/safe_mode.h, branch main</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=main</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2021-03-15T13:57:36+00:00</updated>
<entry>
<title>run code formatting script</title>
<updated>2021-03-15T13:57:36+00:00</updated>
<author>
<name>microDev</name>
<email>70126934+microDev1@users.noreply.github.com</email>
</author>
<published>2021-03-15T13:57:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a52eb88031620a81521b937f2a0651dbac2bb350'/>
<id>urn:sha1:a52eb88031620a81521b937f2a0651dbac2bb350</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add some NORETURN attributes</title>
<updated>2020-09-28T23:55:56+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-09-24T16:20:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=726dcdb60aa84b5070e5484a19e896abdaffeb93'/>
<id>urn:sha1:726dcdb60aa84b5070e5484a19e896abdaffeb93</id>
<content type='text'>
I have a function where it should be impossible to reach the end, so I put in a safe-mode reset at the bottom:
```
int find_unused_slot(void) {
    // precondition: you already verified that a slot was available
    for (int i=0; i&lt;NUM_SLOTS; i++) {
        if( slot_free(i)) {
            return i;
        }
    }
    safe_mode_reset(MICROPY_FATAL_ERROR);
}
```
However, the compiler still gave a diagnostic, because safe_mode_reset was not declared NORETURN.

So I started by teaching the compiler that reset_into_safe_mode never returned.  This leads at least one level deeper due to reset_cpu needing to be a NORETURN function.  Each port is a little different in this area.  I also marked reset_to_bootloader as NORETURN.
Additional notes:

 * stm32's reset_to_bootloader was not implemented, but now does a bare reset.  Most stm32s are not fitted with uf2 bootloaders anyway.
 * ditto cxd56
 * esp32s2 did not implement reset_cpu at all.  I used esp_restart().  (not tested)
 * litex did not implement reset_cpu at all.  I used reboot_ctrl_write.  But notably this is what reset_to_bootloader already did, so one or the other must be incorrect (not tested).  reboot_ctrl_write cannot be declared NORETURN, as it returns unless the special value 0xac is written), so a new unreachable forever-loop is added.
 * cxd56's reset is via a boardctl() call which can't generically be declared NORETURN, so a new unreacahble "for(;;)" forever-loop is added.
 * In several places, NVIC_SystemReset is redeclared with NORETURN applied.  This is accepted just fine by gcc.  I chose this as preferable to editing the multiple copies of CMSIS headers where it is normally declared.
 * the stub safe_mode reset simply aborts.  This is used in mpy-cross.
</content>
</entry>
<entry>
<title>Fix heap without PSRAM. Never set heap_size.</title>
<updated>2020-09-09T00:06:09+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2020-09-09T00:06:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=99f5011d74e3d059a59f7c382974d57f03a0b6e9'/>
<id>urn:sha1:99f5011d74e3d059a59f7c382974d57f03a0b6e9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>supervisor: add a new WATCHDOG_RESET safe mode reason</title>
<updated>2020-05-27T03:28:49+00:00</updated>
<author>
<name>Sean Cross</name>
<email>sean@xobs.io</email>
</author>
<published>2020-05-22T04:56:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=8c5df5f7329f84c005d217d18148b616f55b942f'/>
<id>urn:sha1:8c5df5f7329f84c005d217d18148b616f55b942f</id>
<content type='text'>
This mode will be used if the board is reset due to the watchdog
expiring.

Signed-off-by: Sean Cross &lt;sean@xobs.io&gt;
</content>
</entry>
<entry>
<title>Refine iMX RT memory layout and add three boards</title>
<updated>2020-01-18T01:36:08+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2020-01-09T04:32:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7d8dac9211dab92d750a0351335b4ad3fffc05e2'/>
<id>urn:sha1:7d8dac9211dab92d750a0351335b4ad3fffc05e2</id>
<content type='text'>
Introduces a way to place CircuitPython code and data into
tightly coupled memory (TCM) which is accessible by the CPU in a
single cycle. It also frees up room in the corresponding cache for
intermittent data. Loading from external flash is slow!

The data cache is also now enabled.

Adds support for the iMX RT 1021 chip. Adds three new boards:
* iMX RT 1020 EVK
* iMX RT 1060 EVK
* Teensy 4.0

Related to #2492, #2472 and #2477. Fixes #2475.
</content>
</entry>
<entry>
<title>Fix flash write error handling; clean up safe mode message printing</title>
<updated>2019-12-12T19:41:49+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2019-12-12T19:35:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7889b999ccb32b78ddabc2b2738f0a9d182b9411'/>
<id>urn:sha1:7889b999ccb32b78ddabc2b2738f0a9d182b9411</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Refine _bleio</title>
<updated>2019-10-22T01:57:03+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2019-09-14T19:40:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ae30a1e5aa198bdeee7dce04194b027ff4e3d65a'/>
<id>urn:sha1:ae30a1e5aa198bdeee7dce04194b027ff4e3d65a</id>
<content type='text'>
This PR refines the _bleio API. It was originally motivated by
the addition of a new CircuitPython service that enables reading
and modifying files on the device. Moving the BLE lifecycle outside
of the VM motivated a number of changes to remove heap allocations
in some APIs.

It also motivated unifying connection initiation to the Adapter class
rather than the Central and Peripheral classes which have been removed.
Adapter now handles the GAP portion of BLE including advertising, which
has moved but is largely unchanged, and scanning, which has been enhanced
to return an iterator of filtered results.

Once a connection is created (either by us (aka Central) or a remote
device (aka Peripheral)) it is represented by a new Connection class.
This class knows the current connection state and can discover and
instantiate remote Services along with their Characteristics and
Descriptors.

Relates to #586
</content>
</entry>
<entry>
<title>Rework safe mode so we can trigger on all resets</title>
<updated>2019-05-09T17:15:28+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2019-05-09T17:15:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b87565138ea2027625e69aee4cf1170606e1f40a'/>
<id>urn:sha1:b87565138ea2027625e69aee4cf1170606e1f40a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update `on_next_reset` for new safe mode.</title>
<updated>2019-05-08T22:23:40+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2019-05-08T22:23:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=837d3f57eefe8189969dda6512f278b4fb76af55'/>
<id>urn:sha1:837d3f57eefe8189969dda6512f278b4fb76af55</id>
<content type='text'>
Fixes #1831
</content>
</entry>
<entry>
<title>Enter safe mode when an allocation is attempted on an uninitialized heap.</title>
<updated>2019-03-12T18:18:26+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2019-03-08T23:29:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=03be42ab847f04a89d207d98fdb28048cfedf72d'/>
<id>urn:sha1:03be42ab847f04a89d207d98fdb28048cfedf72d</id>
<content type='text'>
</content>
</entry>
</feed>
