<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/supervisor, branch 6.0.0-beta.2</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0-beta.2</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0-beta.2'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-10-01T18:18:36+00:00</updated>
<entry>
<title>Merge pull request #3469 from jepler/noreturn</title>
<updated>2020-10-01T18:18:36+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@adafruit.com</email>
</author>
<published>2020-10-01T18:18:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d62ac24493abb7aadcf68751997092a1b4141b01'/>
<id>urn:sha1:d62ac24493abb7aadcf68751997092a1b4141b01</id>
<content type='text'>
Add some NORETURN attributes</content>
</entry>
<entry>
<title>Update make translate script</title>
<updated>2020-09-29T05:44:30+00:00</updated>
<author>
<name>microDev</name>
<email>70126934+microDev1@users.noreply.github.com</email>
</author>
<published>2020-09-29T05:44:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4c7d9e3aafbde08399d9839d6cde968f4d1ae005'/>
<id>urn:sha1:4c7d9e3aafbde08399d9839d6cde968f4d1ae005</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>supervisor: stub: make unimplemented safe_mode loop forever</title>
<updated>2020-09-24T21:57:20+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-09-24T21:57:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6bcbe51f7fcfaca6ee3ee40b4ce64fd791725e8f'/>
<id>urn:sha1:6bcbe51f7fcfaca6ee3ee40b4ce64fd791725e8f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>supervisor: Improve serial connection detection</title>
<updated>2020-09-17T23:32:06+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-09-03T18:36:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=28043c94b5ea5f3cce11fa57afa9f3f0141b8dce'/>
<id>urn:sha1:28043c94b5ea5f3cce11fa57afa9f3f0141b8dce</id>
<content type='text'>
These changes remove the caveat from supervisor.runtime.serial_connected.

It appears that _tud_cdc_connected() only tracks explicit changes to the
"DTR" bit, which leads to disconnects not being registered.

Instead:
 * when line state is changed explicitly, track the dtr value in
   _serial_connected
 * when the USB bus is suspended, set _serial_connected to False

Testing performed (using sam e54 xplained):  Run a program to show
the state of `serial_connected` on the LED:
```
import digitalio
import supervisor
import board

led = digitalio.DigitalInOut(board.LED)
while True:
    led.switch_to_output(not supervisor.runtime.serial_connected)
```

Try all the following:
 * open, close serial terminal program
    - LED status tracks whether terminal is open
 * turn on/off data lines using the switchable charge-only cable
    - LED turns off when switch is in "charger" position
    - LED turns back on when switch is in Data position and terminal is
      opened (but doesn't turn back on just because switch position is
      changed)
</content>
</entry>
<entry>
<title>Merge pull request #3398 from jepler/better-dictionary-compression</title>
<updated>2020-09-16T18:10:22+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@adafruit.com</email>
</author>
<published>2020-09-16T18:10:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=750bc1e04ac6f3c5bec7cb6d5f2bdf1e84c45f47'/>
<id>urn:sha1:750bc1e04ac6f3c5bec7cb6d5f2bdf1e84c45f47</id>
<content type='text'>
compression: Implement @ciscorn's dictionary approach</content>
</entry>
<entry>
<title>supervisor translate: explain the dictionary</title>
<updated>2020-09-15T18:18:04+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-09-15T18:18:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d9e336d39f7a19c47cd98619049f5d8e29512947'/>
<id>urn:sha1:d9e336d39f7a19c47cd98619049f5d8e29512947</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update safe_mode.c</title>
<updated>2020-09-13T17:47:14+00:00</updated>
<author>
<name>microDev</name>
<email>70126934+microDev1@users.noreply.github.com</email>
</author>
<published>2020-09-13T17:47:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=506bb097f7af5118a4e52a9471fe4599e681ba39'/>
<id>urn:sha1:506bb097f7af5118a4e52a9471fe4599e681ba39</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update safe mode reason</title>
<updated>2020-09-13T17:27:24+00:00</updated>
<author>
<name>microDev</name>
<email>70126934+microDev1@users.noreply.github.com</email>
</author>
<published>2020-09-13T17:27:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=36da92075b6b83a6b1a998b377f340524d143f35'/>
<id>urn:sha1:36da92075b6b83a6b1a998b377f340524d143f35</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Small improvements to the dictionary compression</title>
<updated>2020-09-13T16:50:01+00:00</updated>
<author>
<name>Taku Fukada</name>
<email>naninunenor@gmail.com</email>
</author>
<published>2020-09-13T16:25:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d18d79ac4709364c2371e2eaefd8f96bb20802e7'/>
<id>urn:sha1:d18d79ac4709364c2371e2eaefd8f96bb20802e7</id>
<content type='text'>
</content>
</entry>
</feed>
