Home > other >  Single-chip microcomputer has a minimum system, Uboot also have, mini - Uboot start process simple a
Single-chip microcomputer has a minimum system, Uboot also have, mini - Uboot start process simple a

Time:11-06

, single-chip microcomputer has a minimum system, the so-called minimum system is single chip microcomputer can work normally required for peripherals, at least for Uboot, also have a minimum system, because the main function is to guide the kernel Uboot, below we analysis through a simple Mini - Uboot Uboot start the loading process, (just the analysis process, the Uboot has guided the kernel function)


Note: just the uboot has the basic function of the kernel boot, just as the early learning to use a simple, starter, and not normal uboot startup process



Here is the root of the mini - uboot tree:





We get a project, want to understand its function, the most convenient is the makefile to read it,


A, the Makefile


(CPP) view plain copy

1. Sinclude include/config. Mk

2.

3. # ARCH=arm

4. # CPU=arm920t

5. # VENDOR=samsung

6. #=s3c2410 SOC

7. # BOARD=smdk2410

8.

9. SRC_TREE:=$(shell PWD)

10. MKCONFIG=$(SRC_TREE)/MKCONFIG

11.

12. INCLUDE_PATH=include

13. DRIVER_PATH=driver

14. LIB_DIR=lib

15.

16.

17. CFLAG=- mabi=apcs - gnu - fno - builtin - fno - builtin function - g - O0 - c - I $(INCLUDE_PATH) - I $(DRIVER_PATH) - o

18. LDFLAG=- Tcpu/arm/arm_cortexa8/map. Typical vmlinux.lds -o

19. The OBJS=CPU/$(ARCH)/$(CPU)/start. O

20. OBJS +=lib_arm/board. O

21. The OBJS +=board/$(VENDOR)/$(board)/lowlevel_init. O

22. The OBJS +=board/$(VENDOR)/$(board)/mem_setup. O

23. The OBJS +=board/$(VENDOR)/$(board)/nand. O

24. The OBJS +=driver/uart. O

25. The OBJS +=lib/string. O

26. The OBJS +=common/do_go. O

27. The OBJS +=common/main. O

28.

29. Ifeq ($(ARCH), arm)

30. CROSS_COMPILE=arm - cortex_a8 - Linux - gnueabi -

31. The endif

32.

33. PROJ_NAME=mini_uboot

34.

35. All: $(OBJS)

36. $(CROSS_COMPILE) ld $(OBJS) $(LDFLAG) $(PROJ_NAME). The elf

37. The binary $$(CROSS_COMPILE) objcopy - O (PROJ_NAME). The elf $(PROJ_NAME). Bin

38. $(CROSS_COMPILE) objdump -d $(PROJ_NAME). The elf & gt; $(PROJ_NAME). Dis

39. The cp *. Bin/tftpboot

40.

41. %. O: % S

42. $(CROSS_COMPILE) GCC $(CFLAG) $@ $& lt;

43. %. O: % s

44. $(CROSS_COMPILE) GCC $(CFLAG) $@ $& lt;

45.

46. %. O: c
%.
47. $(CROSS_COMPILE) GCC $(CFLAG) $@ $& lt;

48.

49. Fsc100_config: # ARCH CPU VENDOR BOARD SOC

50. At $(MKCONFIG) $(@ : _config=) arm arm_cortexa8 samsung fsc100 s5pc100

51. # mkconfig fsc100 arm arm_cortexa8 samsung fsc100 s5pc100

52.

53. Smdk2410_config: # ARCH CPU VENDOR BOARD SOC

54. $(MKCONFIG) $(@ : _config=) arm arm920t samsung smdk2410 s3c2410

55.

56. The clean:

57. @ the rm - rf $(OBJS) *. Bin *. The elf config. Mk



Here in 2440, for example, let's analysis:

(CPP) view plain copy

1. # ARCH=arm

2. # CPU=arm920t

3. # VENDOR=samsung

4. #=s3c2410 SOC

5. # BOARD=smdk2410



Architecture of arm CPU for arm920t, manufacturers samsung, on-chip system sc2410, board for smdk2410,



(CPP) view plain copy

1. The OBJS=CPU/$(ARCH)/$(CPU)/start. O

2. OBJS +=lib_arm/board. O

3. The OBJS +=board/$(VENDOR)/$(board)/lowlevel_init. O

4. The OBJS +=board/$(VENDOR)/$(board)/mem_setup. O

5. OBJS +=board/$(VENDOR)/$(board)/nand. O

6. OBJS +=driver/uart. O

7. OBJS +=lib/string. O

8. OBJS +=common/do_go. O

9. The OBJS +=common/main. O



OBJS for relying on file, generated. O file,

(CPP) view plain copy

1. The ifeq ($(ARCH), arm)

2. The CROSS_COMPILE=arm - cortex_a8 - Linux - gnueabi -

3. The endif



According to the corresponding architecture, making the corresponding cross compile tools,

(CPP) view plain copy

1. All: $(OBJS)

2. $(CROSS_COMPILE) ld $(OBJS) $(LDFLAG) $(PROJ_NAME). The elf

3. The binary $$(CROSS_COMPILE objcopy) - O (PROJ_NAME). The elf $(PROJ_NAME). Bin

4. $(CROSS_COMPILE) objdump -d $(PROJ_NAME). The elf & gt; $(PROJ_NAME). Dis



The first step: to connect; The second step: format conversion; Step 3: the disassembly & gt; "" The meaning of value orientation;

(CPP) view plain copy

1. %. O: % S

2. $(CROSS_COMPILE) GCC $(CFLAG) $@ $& lt;

3. %. O: % s

4. $(CROSS_COMPILE) GCC $(CFLAG) $@ $& lt;

5.

6. %. O: c
%.
7. $(CROSS_COMPILE) GCC $(CFLAG) $@ $& lt;



All. S files,, S file, compiled into the c file. O file,

Note: S files can be accepted in the compilation process parameters, the S file can not be,




Second, link files


(CPP) view plain copy

1. OUTPUT_FORMAT (" elf32 - littlearm ", "elf32 - littlearm", "elf32 - littlearm")

2./* OUTPUT_FORMAT (" elf32 - arm ", "elf32 - arm", "elf32 - arm") */

3. OUTPUT_ARCH (arm)

4. ENTRY (_start)//specified ENTRY address

5. SECTIONS//segment information

6. {

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related