Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 3b8b0fc

Browse files
author
Daniel Campora
committed
esp32: Fix FiPy os.uname() crash and weird P19 and P20 behaviour.
1 parent 2841220 commit 3b8b0fc

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

esp32/bootloader/bootloader.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -878,14 +878,6 @@ static void clock_configure(void)
878878
clk_cfg.slow_freq = rtc_clk_slow_freq_get();
879879
clk_cfg.fast_freq = rtc_clk_fast_freq_get();
880880
rtc_clk_init(clk_cfg);
881-
/* As a slight optimization, if 32k XTAL was enabled in sdkconfig, we enable
882-
* it here. Usually it needs some time to start up, so we amortize at least
883-
* part of the start up time by enabling 32k XTAL early.
884-
* App startup code will wait until the oscillator has started up.
885-
*/
886-
if (!rtc_clk_32k_enabled()) {
887-
rtc_clk_32k_bootstrap();
888-
}
889881
}
890882

891883
static void uart_console_configure(void)

esp32/mods/machrtc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,14 @@ STATIC mp_obj_t mach_rtc_make_new(const mp_obj_type_t *type, mp_uint_t n_args, m
155155
if (args[2].u_obj != mp_const_none) {
156156
struct timeval now;
157157
gettimeofday(&now, NULL);
158-
select_rtc_slow_clk(mp_obj_get_int(args[2].u_obj));
158+
159+
uint32_t clk_src = mp_obj_get_int(args[2].u_obj);
160+
if (clk_src == RTC_SOURCE_EXTERNAL_XTAL) {
161+
if (!rtc_clk_32k_enabled()) {
162+
rtc_clk_32k_bootstrap();
163+
}
164+
}
165+
select_rtc_slow_clk(clk_src);
159166
settimeofday(&now, NULL);
160167
}
161168

esp32/mods/moduos.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,13 @@ STATIC void unmount (os_fs_mount_t *mount_obj) {
224224

225225
STATIC const qstr os_uname_info_fields[] = {
226226
MP_QSTR_sysname, MP_QSTR_nodename,
227-
MP_QSTR_release, MP_QSTR_version,
228-
MP_QSTR_machine,
227+
MP_QSTR_release, MP_QSTR_version
228+
,MP_QSTR_machine
229229
#if defined(LOPY) || defined(FIPY)
230-
MP_QSTR_lorawan
231-
#elif defined(SIPY)
232-
MP_QSTR_sigfox
230+
,MP_QSTR_lorawan
231+
#endif
232+
#if defined(SIPY) || defined(FIPY)
233+
,MP_QSTR_sigfox
233234
#endif
234235
};
235236
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM);

0 commit comments

Comments
 (0)