kopia lustrzana https://github.com/micropython/micropython
cc3200: On the first boot, always make AP ssid='wipy-wlan'.
On the first boot don't add the MAC address, this is to speed up factory testing.pull/1411/head
rodzic
2673374d18
commit
7da2fdc3cd
|
@ -157,6 +157,12 @@ static void bootmgr_board_init(void) {
|
||||||
// mandatory MCU initialization
|
// mandatory MCU initialization
|
||||||
PRCMCC3200MCUInit();
|
PRCMCC3200MCUInit();
|
||||||
|
|
||||||
|
// clear all the special bits, since we can't trust their content after reset
|
||||||
|
PRCMClearSpecialBit(PRCM_SAFE_BOOT_BIT);
|
||||||
|
PRCMClearSpecialBit(PRCM_WDT_RESET_BIT);
|
||||||
|
PRCMClearSpecialBit(PRCM_FIRST_BOOT_BIT);
|
||||||
|
|
||||||
|
// check the reset after clearing the special bits
|
||||||
mperror_bootloader_check_reset_cause();
|
mperror_bootloader_check_reset_cause();
|
||||||
|
|
||||||
#if MICROPY_HW_ANTENNA_DIVERSITY
|
#if MICROPY_HW_ANTENNA_DIVERSITY
|
||||||
|
@ -169,9 +175,6 @@ static void bootmgr_board_init(void) {
|
||||||
|
|
||||||
// init the system led and the system switch
|
// init the system led and the system switch
|
||||||
mperror_init0();
|
mperror_init0();
|
||||||
|
|
||||||
// clear the safe boot flag, since we can't trust its content after reset
|
|
||||||
PRCMClearSpecialBit(PRCM_SAFE_BOOT_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
@ -373,7 +376,7 @@ int main (void) {
|
||||||
}
|
}
|
||||||
sl_FsClose(fhandle, 0, 0, 0);
|
sl_FsClose(fhandle, 0, 0, 0);
|
||||||
}
|
}
|
||||||
// boot info file not present (or read failed)
|
// boot info file not present, it means that this is the first boot after being programmed
|
||||||
if (!bootapp) {
|
if (!bootapp) {
|
||||||
// create a new boot info file
|
// create a new boot info file
|
||||||
_u32 BootInfoCreateFlag = _FS_FILE_OPEN_FLAG_COMMIT | _FS_FILE_PUBLIC_WRITE | _FS_FILE_PUBLIC_READ;
|
_u32 BootInfoCreateFlag = _FS_FILE_OPEN_FLAG_COMMIT | _FS_FILE_PUBLIC_WRITE | _FS_FILE_PUBLIC_READ;
|
||||||
|
@ -385,6 +388,8 @@ int main (void) {
|
||||||
}
|
}
|
||||||
sl_FsClose(fhandle, 0, 0, 0);
|
sl_FsClose(fhandle, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
// signal the first boot to the application
|
||||||
|
PRCMSetSpecialBit(PRCM_FIRST_BOOT_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootapp) {
|
if (bootapp) {
|
||||||
|
|
|
@ -106,12 +106,13 @@ void TASK_Micropython (void *pvParameters) {
|
||||||
uint32_t sp = gc_helper_get_sp();
|
uint32_t sp = gc_helper_get_sp();
|
||||||
gc_collect_init (sp);
|
gc_collect_init (sp);
|
||||||
|
|
||||||
#ifndef DEBUG
|
bool safeboot = false;
|
||||||
bool safeboot = PRCMGetSpecialBit(PRCM_SAFE_BOOT_BIT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mptask_pre_init();
|
mptask_pre_init();
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
safeboot = PRCMGetSpecialBit(PRCM_SAFE_BOOT_BIT);
|
||||||
|
#endif
|
||||||
|
|
||||||
soft_reset:
|
soft_reset:
|
||||||
|
|
||||||
// GC init
|
// GC init
|
||||||
|
@ -372,9 +373,12 @@ STATIC void mptask_init_sflash_filesystem (void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void mptask_enter_ap_mode (void) {
|
STATIC void mptask_enter_ap_mode (void) {
|
||||||
|
// append the mac only if it's not the first boot
|
||||||
|
bool append_mac = !PRCMGetSpecialBit(PRCM_FIRST_BOOT_BIT);
|
||||||
|
|
||||||
// enable simplelink in ap mode (use the MAC address to make the ssid unique)
|
// enable simplelink in ap mode (use the MAC address to make the ssid unique)
|
||||||
wlan_sl_enable (ROLE_AP, MICROPY_PORT_WLAN_AP_SSID, strlen(MICROPY_PORT_WLAN_AP_SSID), MICROPY_PORT_WLAN_AP_SECURITY,
|
wlan_sl_enable (ROLE_AP, MICROPY_PORT_WLAN_AP_SSID, strlen(MICROPY_PORT_WLAN_AP_SSID), MICROPY_PORT_WLAN_AP_SECURITY,
|
||||||
MICROPY_PORT_WLAN_AP_KEY, strlen(MICROPY_PORT_WLAN_AP_KEY), MICROPY_PORT_WLAN_AP_CHANNEL, true);
|
MICROPY_PORT_WLAN_AP_KEY, strlen(MICROPY_PORT_WLAN_AP_KEY), MICROPY_PORT_WLAN_AP_CHANNEL, append_mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void mptask_create_main_py (void) {
|
STATIC void mptask_create_main_py (void) {
|
||||||
|
|
Ładowanie…
Reference in New Issue