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.
This commit is contained in:
Daniel Campora 2015-08-09 19:17:48 +02:00
parent 2673374d18
commit 7da2fdc3cd
2 changed files with 18 additions and 9 deletions

View File

@ -157,6 +157,12 @@ static void bootmgr_board_init(void) {
// mandatory MCU initialization
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();
#if MICROPY_HW_ANTENNA_DIVERSITY
@ -169,9 +175,6 @@ static void bootmgr_board_init(void) {
// init the system led and the system switch
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);
}
// 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) {
// create a new boot info file
_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);
}
// signal the first boot to the application
PRCMSetSpecialBit(PRCM_FIRST_BOOT_BIT);
}
if (bootapp) {

View File

@ -106,12 +106,13 @@ void TASK_Micropython (void *pvParameters) {
uint32_t sp = gc_helper_get_sp();
gc_collect_init (sp);
#ifndef DEBUG
bool safeboot = PRCMGetSpecialBit(PRCM_SAFE_BOOT_BIT);
#endif
bool safeboot = false;
mptask_pre_init();
#ifndef DEBUG
safeboot = PRCMGetSpecialBit(PRCM_SAFE_BOOT_BIT);
#endif
soft_reset:
// GC init
@ -372,9 +373,12 @@ STATIC void mptask_init_sflash_filesystem (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)
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) {