Write a bare-board program under the arm program from scratch.
Write a bare board program under the arm from scratch. our entire program runs based on uboot. we can use printf in uboot for output. The standard output of the default development version is the serial port. the default standard output screen of the computer. 1. the files to be created are stored in the include folder. 2. create a hw. h header file. 3. write a common. h, which defines the macros that borrow the printf of uboot. and the definition of NULL macro. 4. hw. c hardware-related files. 5. main. c file. 6. start. s Assembly file. 7. ld. lds link script, 8. makefile is used to manage the configuration files for compiling projects. the detailed analysis of each step is as follows: /*************************************** */1. create an include file. zshh @ HP :~ /Work/android/code/hardware $ mkdir my01porject // create a project file. zshh @ HP :~ /Work/android/code/hardware $ cd my01porject // switch to the current project path. zshh @ HP :~ /Work/android/code/hardware/my01porject $ mkdir include // create an include folder. /*************************************** */2. create hw. h hardware-related operations, # ifndef _ MY_HW_H # define _ MY_HW_Hextern int hw_init (void); // This is the hardware initialization operation. extern int hw_opts (void); // This is a hardware operation function. # endif /************************************* */3. h. # ifndef _ MY_COMMON_H # define NULL (void *) 0 // macro NULL is defined // a pri is defined Ntf macro, (_ VA_ARGS _) must add this representation when defining variable parameters, // int (*) (const char *,...) is a function pointer type. // convert the 0x43e11434 number to the current function pointer type. # define printf (...) (int (*) (const char *,...)) 0x43e11434) (_ VA_ARGS _) # if 0 // note that we need to explain the origin of this parameter. 0x43e11434, // switch to the directory where the uboot source code is located. zshh @ HP :~ /Work/arm data/exynos4412_lzy/src/uboot/uboot-2012-12 $ lsapi COPYING examples Makefile README u-bootarch COPYING.txt fs mkconfig rules. mk u-boot.binboard CREDITS include nand_spl sd_fuse u-boot.ldsboards.cfg disk lib net snapshot. commit u-boot.mapcommon doc MAINTAINERS onenand_ipl System. map u-boot.srecconfig.mk drivers MAKEALL post tools # How is endif in Makefile, is to notice you, all the link addresses of the current function are placed. system. in map. SYSTE M_MAP =\$ (NM) $1 | \ grep-v '\ (compiled \) \ | \(\. o $ \) \ | \ ([aUw] \) \ | \(\. \. ng $ \) \ | \ (LASH [RL] DI \) '| \ LC_ALL = C sort $ (obj) System. map: $ (obj) u-boot @ $ (call SYSTEM_MAP, $ <) >$ (obj) System. map: I copied the System. A part opened by map. among them, 43e11434 T printf is the URL of uboot. 43e11294 T response T fgetc43e11304 T ftstc43e11330 T response T fputs43e11380 T fprintf43e113cc T getc43e113e4 T tstc43e113fc T putc43e11418 T puts43e11434 T printf43e11478 T vprintf // find the address of a function in c. you can call the function. method. # endif /************************************* */4. write a test class hw. c file. # include