int main(void) { struct image_info image; char *media_str = NULL; int ret; char filename[FILENAME_BUF_LEN]; char of_filename[FILENAME_BUF_LEN]; memset(&image, 0, sizeof(image)); memset(filename, 0, FILENAME_BUF_LEN); memset(of_filename, 0, FILENAME_BUF_LEN); image.dest = (unsigned char *)JUMP_ADDR; #ifdef CONFIG_OF_LIBFDT image.of = 1; image.of_dest = (unsigned char *)OF_ADDRESS; #endif #ifdef CONFIG_FLASH media_str = "FLASH: "; image.offset = IMG_ADDRESS; #if !defined(CONFIG_LOAD_LINUX) && !defined(CONFIG_LOAD_ANDROID) image.length = IMG_SIZE; #endif #ifdef CONFIG_OF_LIBFDT image.of_offset = OF_OFFSET; #endif #endif #ifdef CONFIG_NANDFLASH media_str = "NAND: "; image.offset = IMG_ADDRESS; #if !defined(CONFIG_LOAD_LINUX) && !defined(CONFIG_LOAD_ANDROID) image.length = IMG_SIZE; #endif #ifdef CONFIG_OF_LIBFDT image.of_offset = OF_OFFSET; #endif #endif #ifdef CONFIG_DATAFLASH media_str = "SF: "; image.offset = IMG_ADDRESS; #if !defined(CONFIG_LOAD_LINUX) && !defined(CONFIG_LOAD_ANDROID) image.length = IMG_SIZE; #endif #ifdef CONFIG_OF_LIBFDT image.of_offset = OF_OFFSET; #endif #endif #ifdef CONFIG_SDCARD media_str = "SD/MMC: "; image.filename = filename; strcpy(image.filename, IMAGE_NAME); #ifdef CONFIG_OF_LIBFDT image.of_filename = of_filename; #endif #endif #ifdef CONFIG_HW_INIT hw_init(); #endif #if defined(CONFIG_SCLK) #if !defined(CONFIG_SAMA5D4) slowclk_enable_osc32(); #endif #endif #ifdef CONFIG_HW_DISPLAY_BANNER display_banner(); #endif #ifdef CONFIG_REDIRECT_ALL_INTS_AIC redirect_interrupts_to_nsaic(); #endif #ifdef CONFIG_LOAD_HW_INFO /* Load board hw informaion */ load_board_hw_info(); #endif #ifdef CONFIG_PM at91_board_pm(); #endif #ifdef CONFIG_DISABLE_ACT8865_I2C act8865_workaround(); #endif init_loadfunction(); #if defined(CONFIG_SECURE) image.dest -= sizeof(at91_secure_header_t); #endif ret = (*load_image)(&image); #if defined(CONFIG_SECURE) if (!ret) ret = secure_check(image.dest); image.dest += sizeof(at91_secure_header_t); #endif if (media_str) usart_puts(media_str); if (ret == 0){ usart_puts("Done to load image\n"); } if (ret == -1) { usart_puts("Failed to load image\n"); while(1); } if (ret == -2) { usart_puts("Success to recovery\n"); while (1); } #ifdef CONFIG_SCLK slowclk_switch_osc32(); #endif #if defined(CONFIG_ENTER_NWD) switch_normal_world(); /* point never reached with TZ support */ #endif return JUMP_ADDR; }
int main(void) { struct image_info image; char *media_str = NULL; int ret; char filename[FILENAME_BUF_LEN]; char of_filename[FILENAME_BUF_LEN]; memset(&image, 0, sizeof(image)); memset(filename, 0, FILENAME_BUF_LEN); memset(of_filename, 0, FILENAME_BUF_LEN); image.dest = (unsigned char *)JUMP_ADDR; #ifdef CONFIG_OF_LIBFDT image.of = 1; image.of_dest = (unsigned char *)OF_ADDRESS; #endif #ifdef CONFIG_NANDFLASH media_str = "NAND: "; image.offset = IMG_ADDRESS; #if !defined(CONFIG_LOAD_LINUX) && !defined(CONFIG_LOAD_ANDROID) image.length = IMG_SIZE; #endif #ifdef CONFIG_OF_LIBFDT image.of_offset = OF_OFFSET; #endif #endif #ifdef CONFIG_DATAFLASH media_str = "SF: "; image.offset = IMG_ADDRESS; #if !defined(CONFIG_LOAD_LINUX) && !defined(CONFIG_LOAD_ANDROID) image.length = IMG_SIZE; #endif #ifdef CONFIG_OF_LIBFDT image.of_offset = OF_OFFSET; #endif #endif #ifdef CONFIG_SDCARD media_str = "SD/MMC: "; image.filename = filename; strcpy(image.filename, IMAGE_NAME); #ifdef CONFIG_OF_LIBFDT image.of_filename = of_filename; #endif #endif #ifdef CONFIG_HW_INIT hw_init(); #endif display_banner(); #ifdef CONFIG_LOAD_ONE_WIRE /* Load one wire informaion */ load_1wire_info(); #endif init_loadfunction(); ret = (*load_image)(&image); if (media_str) usart_puts(media_str); if (ret == 0){ usart_puts("Done to load image\n"); } if (ret == -1) { usart_puts("Failed to load image\n"); while(1); } if (ret == -2) { usart_puts("Success to recovery\n"); while (1); } #ifdef CONFIG_SCLK slowclk_switch_osc32(); #endif #if defined(CONFIG_ENTER_NWD) switch_normal_world(); /* point never reached with TZ support */ #endif return JUMP_ADDR; }