Changeset 16
- Timestamp:
- Oct 31, 2008, 11:55:55 AM (16 years ago)
- Location:
- tt-loader
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tt-loader/Makefile
r15 r16 5 5 LDFLAGS = -g $(LIBS) 6 6 APP_NAME = tt-loader 7 APP_VERSION = 0.2. 17 APP_VERSION = 0.2.2 8 8 9 9 # Adapt this to your system … … 30 30 pkg: 2nd 31 31 rm -f $(APP_NAME)-$(APP_VERSION).tar.gz 32 tar czf $(APP_NAME)-$(APP_VERSION).tar.gz Makefile *.c COPYING README \ 33 CMD-SYNTAX commands.txt write-splash.txt FlashWriteNAND.txt \ 34 tt-loader.sh 2nd/arm.ld 2nd/*.h 2nd/*.c 2nd/Makefile 2nd/start.S 2nd/2nd.bin 32 mkdir -p $(APP_NAME)-$(APP_VERSION)/2nd 33 cp -a Makefile *.c COPYING README CMD-SYNTAX start-kernel.txt \ 34 commands.txt write-splash.txt FlashWriteNAND.txt tt-loader.sh \ 35 $(APP_NAME)-$(APP_VERSION) 36 cp -a 2nd/arm.ld 2nd/*.h 2nd/*.c 2nd/Makefile 2nd/start.S 2nd/2nd.bin \ 37 $(APP_NAME)-$(APP_VERSION)/2nd 38 tar czf $(APP_NAME)-$(APP_VERSION).tar.gz $(APP_NAME)-$(APP_VERSION) 39 rm -rf $(APP_NAME)-$(APP_VERSION) 35 40 36 41 %.dis: %.bin -
tt-loader/commands.txt
r12 r16 453 453 end 454 454 /////////////////////////////////////////////////////////////////// READNAND END 455 456 /////////////////////////////////////////////////////////////////// KERNEL 457 # Booting TT with modified hosted u-boot 458 a 0x20010000 459 f x-load.bin 460 461 // Call a sub from x-load.bin: TT BoardInit (should only work with TT) 462 a 0x20010da4 463 c 464 465 // Load updated u-boot.bin 466 a 0x10280000 467 f u-boot-updated.bin 468 469 a 0x11800000 470 f uImage.bin 471 472 // Send u-boot start address and boot there, u-boot "bootcmd" must has 473 // fixed to not download kernel from NAND but always boot the kernel 474 // loaded at 0x11800000 address in RAM 475 a 0x10280000 476 b 477 478 end 479 /////////////////////////////////////////////////////////////////// KERNEL END 455 480 456 481 /////////////////////////////////////////////////////////////////// U-BOOT -
tt-loader/main.c
r13 r16 66 66 static double ticks ; 67 67 68 #define log1(X) fprintf(stderr, "%9.3f: "X,((double)times(NULL)-btime)/ticks)69 68 #define log2(X,Y) fprintf(stderr, "%9.3f: "X,((double)times(NULL)-btime)/ticks,(Y)) 70 69 #define log3(X,Y,Z) fprintf(stderr, "%9.3f: "X,((double)times(NULL)-btime)/ticks,(Y),(Z)) … … 78 77 # define le32_to_cpu(x) bswap_32 (x) 79 78 #endif 79 80 static inline double chrono () 81 { 82 return ((double)times(NULL)-btime)/ticks ; 83 } 84 85 static inline void log1 ( const char *msg ) 86 { 87 fprintf(stderr, "%9.3f: ", chrono()); 88 return (void)fprintf(stderr, msg); 89 } 80 90 81 91 static inline unsigned round_up (unsigned v, unsigned d) … … 248 258 for (;;) 249 259 { 250 err= usb_set_configuration (handle, 1);260 err= -usb_set_configuration (handle, 1); 251 261 if (err == 0) 252 262 break; 253 254 if (err == -ENODEV) 263 264 // TODO: l'erreur ENODEV est peut-être juste un problème temporaire dans le noyau 265 // et peut réclamer de ré-essayer, y compris plus tard dans le code 266 if (err == ENODEV) 255 267 { 256 log1("OMAP error, retrying\n");268 log1("OMAP error, aborting\n"); 257 269 return 1; 258 270 } 271 else if (err == EPERM) 272 { 273 log1("USB error, you don't have rights to open OMAP device, aborting\n"); 274 return 1; 275 } 276 else if (err == ETIME) 277 { 278 log1("OMAP error, you need to reboot your OMAP device, aborting\n"); 279 return 1; 280 } 281 else 282 log2("OMAP error %d, retrying\n",err); 259 283 260 sleep (1);284 usleep (100000); 261 285 } 262 286 … … 814 838 log1("Asking boot\n"); 815 839 // Quit now witout error set 816 loop = err = -10 ;840 loop = err = 0 ; 817 841 cmd = cmdfile.size ; 818 842 res = 1 ; … … 839 863 { 840 864 log2("Can't read mach id '%s'\n",&cmdp[cmd]); 841 loop = 0 ; // Just quit on error865 loop = -10 ; // Just quit on error 842 866 break ; 843 867 } … … 845 869 log1("Asking kernel to boot\n"); 846 870 // Quit now witout error set 847 loop = err = -10 ;871 loop = err = 0 ; 848 872 cmd = cmdfile.size ; 849 873 res = 1 ; … … 919 943 int main (int argc, char *argv[]) 920 944 { 921 int size ;945 int size, err=-1; 922 946 btime = (double) times(NULL); 923 947 ticks = (double) sysconf(_SC_CLK_TCK) / 1000 ; … … 925 949 if (argc < NUM_ARGS) 926 950 { 927 log2("Usage: %s <2nd_boot_file> <command_file>\n", argv[ARG_PROGNAME]);951 fprintf(stderr, "Usage: %s <2nd_boot_file> <command_file>\n", argv[ARG_PROGNAME]); 928 952 return 1; 929 953 } … … 931 955 memset (buffer, 0, 128); 932 956 933 u_int32_t 957 u_int32_t *p= (u_int32_t *) buffer; 934 958 p[0x00]= cpu_to_le32 (0xf0030002); 935 959 … … 1003 1027 { 1004 1028 log1("Searching OMAP730-USB connection...\n"); 1005 struct usb_bus *bus; 1006 for (bus= usb_get_busses (); bus; bus= bus->next) 1029 while ( chrono() < 30000 ) 1007 1030 { 1008 struct usb_device *dev; 1031 struct usb_bus *bus; 1032 for (bus= usb_get_busses (); bus; bus= bus->next) 1033 { 1034 struct usb_device *dev; 1035 1036 for (dev= bus->devices; dev; dev= dev->next) 1037 { 1038 usb_dev_handle *handle; 1039 if (dev->descriptor.idVendor == OMAP_VENDOR && 1040 dev->descriptor.idProduct == OMAP_PRODUCT && 1041 (handle= usb_open (dev)) != NULL) 1042 { 1043 log1("Found OMAP730-USB connection\n"); 1044 int res= process (handle); 1045 // TODO Ajouter la déconnexion de la device avec une option pour la garder (cas de renvoi de console) 1046 usb_close (handle); 1047 if (res == 0) { 1048 log1("OMAP730-USB connection processed\n"); 1049 err = 0 ; 1050 break ; 1051 1052 } else { 1053 log1("OMAP730-USB processing failed\n"); 1054 err = 1 ; 1055 break ; 1056 } 1057 } 1058 } 1059 if ( err >= 0 ) 1060 break ; 1061 } 1009 1062 1010 for (dev= bus->devices; dev; dev= dev->next) 1011 { 1012 usb_dev_handle *handle; 1013 if (dev->descriptor.idVendor == OMAP_VENDOR && 1014 dev->descriptor.idProduct == OMAP_PRODUCT && 1015 (handle= usb_open (dev)) != NULL) 1016 { 1017 log1("Found OMAP730-USB connection\n"); 1018 int res= process (handle); 1019 usb_close (handle); 1020 if (res == 0) { 1021 log1("OMAP730-USB connection processed\n"); 1022 return 0 ; 1023 } else 1024 log1("OMAP730-USB processing failed\n"); 1025 } 1026 } 1063 if ( err >= 0 ) 1064 break ; 1065 1066 while ( ! usb_find_devices() && chrono() < 5000 ) 1067 usleep(10000); 1027 1068 } 1069 1070 if (err<0) 1071 log1("Time-out: No OMAP-730 found\n"); 1072 1028 1073 1029 1074 } else { … … 1034 1079 if (cmdfile.content!=NULL) 1035 1080 free((void *)cmdfile.content); 1036 1037 log1("No target connection found\n"); 1081 1038 1082 return 1 ; 1039 1083 }
Note: See TracChangeset
for help on using the changeset viewer.