README.standalone (ced6466ed520749ea73651b45fabeb5a3efa9c8b) | README.standalone (0df01fd3d71481b5cc7aeea6a741b9fc3be15178) |
---|---|
1Design Notes on Exporting U-Boot Functions to Standalone Applications: 2====================================================================== 3 41. The functions are exported by U-Boot via a jump table. The jump 5 table is allocated and initialized in the jumptable_init() routine 6 (common/exports.c). Other routines may also modify the jump table, 7 however. The jump table can be accessed as the 'jt' field of the 8 'global_data' structure. The slot numbers for the jump table are --- 5 unchanged lines hidden (view full) --- 14 15 gd->jt[XF_malloc] = my_malloc; 16 gd->jt[XF_free] = my_free; 17 18 Note that the pointers to the functions all have 'void *' type and 19 thus the compiler cannot perform type checks on these assignments. 20 212. The pointer to the jump table is passed to the application in a | 1Design Notes on Exporting U-Boot Functions to Standalone Applications: 2====================================================================== 3 41. The functions are exported by U-Boot via a jump table. The jump 5 table is allocated and initialized in the jumptable_init() routine 6 (common/exports.c). Other routines may also modify the jump table, 7 however. The jump table can be accessed as the 'jt' field of the 8 'global_data' structure. The slot numbers for the jump table are --- 5 unchanged lines hidden (view full) --- 14 15 gd->jt[XF_malloc] = my_malloc; 16 gd->jt[XF_free] = my_free; 17 18 Note that the pointers to the functions all have 'void *' type and 19 thus the compiler cannot perform type checks on these assignments. 20 212. The pointer to the jump table is passed to the application in a |
22 machine-dependent way. PowerPC, ARM, MIPS and Blackfin architectures 23 use a dedicated register to hold the pointer to the 'global_data' 24 structure: r2 on PowerPC, r8 on ARM, k0 on MIPS, and P3 on Blackfin. 25 The x86 architecture does not use such a register; instead, the 26 pointer to the 'global_data' structure is passed as 'argv[-1]' 27 pointer. | 22 machine-dependent way. PowerPC, ARM, MIPS, Blackfin and Nios II 23 architectures use a dedicated register to hold the pointer to the 24 'global_data' structure: r2 on PowerPC, r8 on ARM, k0 on MIPS, 25 P3 on Blackfin and gp on Nios II. The x86 architecture does not 26 use such a register; instead, the pointer to the 'global_data' 27 structure is passed as 'argv[-1]' pointer. |
28 29 The application can access the 'global_data' structure in the same 30 way as U-Boot does: 31 32 DECLARE_GLOBAL_DATA_PTR; 33 34 printf("U-Boot relocation offset: %x\n", gd->reloc_off); 35 --- 15 unchanged lines hidden (view full) --- 51 follows: 52 53 Load address Start address 54 x86 0x00040000 0x00040000 55 PowerPC 0x00040000 0x00040004 56 ARM 0x0c100000 0x0c100000 57 MIPS 0x80200000 0x80200000 58 Blackfin 0x00001000 0x00001000 | 28 29 The application can access the 'global_data' structure in the same 30 way as U-Boot does: 31 32 DECLARE_GLOBAL_DATA_PTR; 33 34 printf("U-Boot relocation offset: %x\n", gd->reloc_off); 35 --- 15 unchanged lines hidden (view full) --- 51 follows: 52 53 Load address Start address 54 x86 0x00040000 0x00040000 55 PowerPC 0x00040000 0x00040004 56 ARM 0x0c100000 0x0c100000 57 MIPS 0x80200000 0x80200000 58 Blackfin 0x00001000 0x00001000 |
59 Nios II 0x02000000 0x02000000 |
|
59 60 For example, the "hello world" application may be loaded and 61 executed on a PowerPC board with the following commands: 62 63 => tftp 0x40000 hello_world.bin 64 => go 0x40004 65 665. To export some additional function foobar(), the following steps --- 32 unchanged lines hidden --- | 60 61 For example, the "hello world" application may be loaded and 62 executed on a PowerPC board with the following commands: 63 64 => tftp 0x40000 hello_world.bin 65 => go 0x40004 66 675. To export some additional function foobar(), the following steps --- 32 unchanged lines hidden --- |