Skip to content

Commit 01a3a6f

Browse files
author
Catherine Garabedian
authored
Preventing unrecoverable loop when iOBC has no SD card
Preventing unrecoverable loop when iOBC has no SD card
2 parents e1e5c58 + dc3b827 commit 01a3a6f

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

include/configs/at91sam9g20isis.h

+41-11
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
#define CONFIG_RED_LED AT91_PIN_PC12 /* this is the power led */
8080
#define CONFIG_GREEN_LED AT91_PIN_PC13 /* this is the user led */
8181
#define CONFIG_YELLOW_LED AT91_PIN_PC14
82-
#define CONFIG_BLUE_LED AT91_PIN_PC15 /* Unused */
82+
#define CONFIG_BLUE_LED AT91_PIN_PC15 /* Unused */
8383

8484
/* SPI */
8585
#define CONFIG_ATMEL_SPI
@@ -102,7 +102,7 @@
102102
"rootfs part 0 6\0"
103103

104104
#define DFU_ALT_INFO_NOR \
105-
"dfu_alt_info_nor=" \
105+
"dfu_alt_info_nor=" \
106106
"uboot raw 0xA000 0x56000;" \
107107
"dtb raw 0x70000 0x10000" \
108108
"\0"
@@ -166,11 +166,11 @@
166166
#define CONFIG_EXT4_WRITE
167167

168168
/* u-boot env in sd/mmc card */
169-
#define CONFIG_ENV_IS_IN_EXT4 1
170-
#define EXT4_ENV_INTERFACE "mmc"
169+
#define CONFIG_ENV_IS_IN_EXT4 1
170+
#define EXT4_ENV_INTERFACE "mmc"
171171
#define EXT4_ENV_DEVICE_AND_PART "0:1"
172-
#define EXT4_ENV_FILE "/system/etc/uboot.env"
173-
#define CONFIG_ENV_SIZE 1 * 1024 //Assume sector size of 1024
172+
#define EXT4_ENV_FILE "/system/etc/uboot.env"
173+
#define CONFIG_ENV_SIZE 1 * 1024 //Assume sector size of 1024
174174
#endif
175175

176176
/* USB */
@@ -190,17 +190,47 @@
190190
#ifdef CONFIG_SYS_USE_NORFLASH
191191
#define SMALL_SECT_SIZE 0x1000
192192
#define LARGE_SECT_SIZE 0x10000
193-
/* (bootstrap + u-boot + dtb (+ altOS) in flash) + (env + linux in mmc) */
194-
/* Copy .dtb file (NORFLASH @ 0x70000, size = 0x10000) and kernel (SD card, partition 5) into SDRAM, then boot them */
195-
#define CONFIG_BOOTCOMMAND "cp.b 0x10070000 0x21800000 0x10000; " \
196-
"fatload mmc 0:5 0x2187FF58 kernel; " \
197-
"bootm 0x2187FF58 - 0x21800000"
193+
194+
#ifdef CONFIG_SD_SWITCH
195+
#define CONFIG_BOOTCOMMAND \
196+
"if mmc rescan; then " \
197+
"run mmc_boot; " \
198+
"else " \
199+
"mmc slot 0; " \
200+
"if mmc rescan; then " \
201+
"run mmc_boot; " \
202+
"else " \
203+
"mmc slot 1; " \
204+
"if mmc rescan; then " \
205+
"run mmc_boot; " \
206+
"else " \
207+
"echo ERROR: Failed to boot. Unable to communicate with SD card; " \
208+
"fi; " \
209+
"fi; " \
210+
"fi;"
211+
#else
212+
#define CONFIG_BOOTCOMMAND \
213+
"if mmc rescan; then " \
214+
"run mmc_boot; " \
215+
"else " \
216+
"echo ERROR: Failed to boot. Unable to communicate with SD card; " \
217+
"fi;"
218+
#endif
219+
198220
/* Define the initial console connection and rootfs location */
199221
#define CONFIG_BOOTARGS \
200222
"console=ttyS0,115200 " \
201223
"root=/dev/mmcblk0p6 rootwait"
202224

225+
/* (bootstrap + u-boot + dtb (+ altOS) in flash) + (env + linux in mmc) */
226+
/* Copy .dtb file (NORFLASH @ 0x70000, size = 0x10000) and kernel (SD card, partition 5) into SDRAM, then boot them */
227+
#define MMC_BOOT \
228+
"mmc_boot=cp.b 0x10070000 0x21800000 0x10000; " \
229+
"fatload mmc 0:5 0x2187FF58 kernel; " \
230+
"bootm 0x2187FF58 - 0x21800000\0"
231+
203232
#define CONFIG_EXTRA_ENV_SETTINGS \
233+
MMC_BOOT \
204234
KUBOS_UPDATE_ARGS
205235

206236
#define CONFIG_SYS_FLASH_CFI 1

0 commit comments

Comments
 (0)