esp8266/esp_mphal: Move most functions in esp_mphal.c from iRAM to iROM.
The ones that are moved out of iRAM should not need to be there, because
either they call functions in iROM (eg mp_hal_stdout_tx_str), or they are
only ever called from a function in iROM and not from an interrupt (eg
ets_esf_free_bufs).
This frees up about 800 bytes of iRAM.
diff --git a/ports/esp8266/esp_mphal.c b/ports/esp8266/esp_mphal.c
index 20d0557..c467ab7 100644
--- a/ports/esp8266/esp_mphal.c
+++ b/ports/esp8266/esp_mphal.c
@@ -50,7 +50,7 @@
uart_attached_to_dupterm = 0;
}
-void mp_hal_delay_us(uint32_t us) {
+void MP_FASTCODE(mp_hal_delay_us)(uint32_t us) {
uint32_t start = system_get_time();
while (system_get_time() - start < us) {
ets_event_poll();
@@ -128,17 +128,13 @@
}
}
-uint32_t mp_hal_ticks_ms(void) {
+uint32_t MP_FASTCODE(mp_hal_ticks_ms)(void) {
// Compute milliseconds from 64-bit microsecond counter
system_time_update();
return ((uint64_t)system_time_high_word << 32 | (uint64_t)system_time_low_word) / 1000;
}
-uint32_t mp_hal_ticks_us(void) {
- return system_get_time();
-}
-
-void mp_hal_delay_ms(uint32_t delay) {
+void MP_FASTCODE(mp_hal_delay_ms)(uint32_t delay) {
mp_hal_delay_us(delay * 1000);
}
@@ -152,7 +148,8 @@
mp_raise_msg(&mp_type_AssertionError, MP_ERROR_TEXT("C-level assert"));
}
-void mp_hal_signal_input(void) {
+// May be called by uart0_rx_intr_handler.
+void MP_FASTCODE(mp_hal_signal_input)(void) {
#if MICROPY_REPL_EVENT_DRIVEN
system_os_post(UART_TASK_ID, 0, 0);
#endif