Wykres commitów

11 Commity (master)

Autor SHA1 Wiadomość Data
Angus Gratton decf8e6a8b all: Remove the "STATIC" macro and just use "static" instead.
The STATIC macro was introduced a very long time ago in commit
d5df6cd44a.  The original reason for this was
to have the option to define it to nothing so that all static functions
become global functions and therefore visible to certain debug tools, so
one could do function size comparison and other things.

This STATIC feature is rarely (if ever) used.  And with the use of LTO and
heavy inline optimisation, analysing the size of individual functions when
they are not static is not a good representation of the size of code when
fully optimised.

So the macro does not have much use and it's simpler to just remove it.
Then you know exactly what it's doing.  For example, newcomers don't have
to learn what the STATIC macro is and why it exists.  Reading the code is
also less "loud" with a lowercase static.

One other minor point in favour of removing it, is that it stops bugs with
`STATIC inline`, which should always be `static inline`.

Methodology for this commit was:

1) git ls-files | egrep '\.[ch]$' | \
   xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/"

2) Do some manual cleanup in the diff by searching for the word STATIC in
   comments and changing those back.

3) "git-grep STATIC docs/", manually fixed those cases.

4) "rg -t python STATIC", manually fixed codegen lines that used STATIC.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-07 14:20:42 +11:00
Jim Mussared 986ad6bf1d stm32/boardctrl: Use HAL_Delay instead of mp_hal_delay_ms.
Not safe to use mp_hal_delay_ms before boot if threading is enabled,
because threading will not have been initialised, and
MICROPY_EVENT_POLL_HOOK assumes threading is initialised.

HAL_Delay doesn't call MICROPY_EVENT_POLL_HOOK, but is still
power-efficient like mp_hal_delay_ms (unlike mp_hal_delay_us).

Fixes #7816.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26 12:48:04 +10:00
Damien George 9af6a275dd stm32/boardctrl: Allow boards to override fatal-error handler.
To override it a board must define MICROPY_BOARD_FATAL_ERROR to a function
that takes a string message and does not return.

Signed-off-by: Damien George <damien@micropython.org>
2022-07-08 23:47:29 +10:00
Damien George d8e7ecd231 stm32/modmachine: Factor out mboot enter code to a function.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-17 13:57:47 +10:00
Damien George 136369d72f all: Update to point to files in new shared/ directory.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12 17:08:10 +10:00
Damien George 87985fc7e9 stm32/boardctrl: Skip running main.py if boot.py had an error.
Previous behaviour was: if boot.py had an exception then main.py would
still run, which is arguably unexpected behaviour.

This commit changes the behaviour so main.py is not run if boot.py has an
error.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-30 13:24:40 +10:00
Damien George 9ee116c452 stm32/boardctrl: Adjust logic for running boot.py, main.py.
This new logic is equivalent to the old logic when the only possibilities
for reset_mode are NORMAL, SAFE_MODE and FILESYSTEM, which is the standard
case.  But the new logic also allows other reset_mode values (eg
BOOTLOADER) to run boot.py and main.py.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-12 13:44:47 +10:00
Damien George 885b246ca9 stm32/boardctrl: Show first reset-mode state on LEDs when selecting.
Commit 1e297c8898 introduced a bug where the
very first reset-mode state on the LEDs was not shown, because prior to
that commit the first reset-mode state was the same as the initial LED
state (green on, others off) and update_reset_mode() was called after
setting this initial LED state.

This is fixed in this commit by changing the update_reset_mode() loop so
that it displays the current reset mode before doing the delay.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:32:12 +10:00
Damien George a72b8443ca stm32/boardctrl: Add constants for reset mode values.
And use the same boardctrl.h header for both the application and mboot so
these constants are consistent.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:31:35 +10:00
Damien George 7b41d7f187 stm32/boardctrl: Give boards control over execution of boot.py,main.py.
This commit simplifies the customisation of the main MicroPython execution
loop (4 macros are reduced to 2), and allows a board to have full control
over the execution (or not) of boot.py and main.py.

For boards that use the default start-up code, there is no functional
change in this commit.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 12:44:19 +10:00
Damien George 4c3976bbca stm32: Add MICROPY_BOARD calls in various places in stm32_main.
For a board to have full configurability of the soft reset loop.

Signed-off-by: Damien George <damien@micropython.org>
2020-11-11 21:41:04 +11:00