1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-26 01:10:18 +02:00

qi-add-steppingstone-section-for-putc.patch

We need putc even when we are operating entirely from steppingstone.
Arrange that the board-specific putc code is in a section that goes into
steppingstone, and adapt the utils.c putc() so that it no longer needs to
indirect through the board_api struct that is in main memory.

Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
Andy Green 2008-11-28 10:16:41 +00:00 committed by Andy Green
parent 2e982c433d
commit 8d0a6cbd9f
8 changed files with 41 additions and 27 deletions

View File

@ -108,5 +108,7 @@ int nand_read_ll(unsigned char *buf, unsigned long start512, int blocks512);
extern void memory_test(void * start, unsigned int length);
void set_putc_func(void (*p)(char));
#endif

View File

@ -341,7 +341,7 @@ const struct board_variant const * get_board_variant_gta02(void)
return &board_variants[gta02_get_pcb_revision() & 1];
}
static void putc_gta02(char c)
static __attribute__ (( section (".steppingstone") )) void putc_gta02(char c)
{
serial_putc_s3c24xx(GTA02_DEBUG_UART, c);
}

View File

@ -37,12 +37,16 @@ SECTIONS
. = ALIGN(4);
.text :
{
src/cpu/s3c2442/start.o (.text .rodata* .data)
src/cpu/s3c2442/lowlevel_init.o (.text .rodata* .data)
src/cpu/s3c2442/start_qi.o (.text .rodata* .data)
src/blink_led.o (.text .rodata* .data)
src/cpu/s3c2442/nand_read.o (.text .rodata* .data)
src/cpu/s3c2442/serial-s3c24xx.o (.text .rodata* .data)
src/cpu/s3c2442/start.o (.text .rodata* .data .bss)
src/cpu/s3c2442/lowlevel_init.o (.text .rodata* .data .bss)
src/cpu/s3c2442/start_qi.o (.text .rodata* .data .bss)
/* src/blink_led.o (.text .rodata* .data .bss) */
src/cpu/s3c2442/nand_read.o (.text .rodata* .data .bss)
src/cpu/s3c2442/serial-s3c24xx.o (.text .rodata* .data .bss)
src/memory-test.o (.text .rodata* .data .bss)
src/utils.o (.text .rodata* .data .bss)
src/ctype.o (.text .rodata* .data .bss)
* (.steppingstone)
}
. = ALIGN(4);

View File

@ -98,6 +98,7 @@ void start_qi(void)
}
this_board->port_init();
set_putc_func(this_board->putc);
/* stick some hello messages on debug console */

View File

@ -166,7 +166,7 @@ int is_this_board_gta03(void)
return 1;
}
static void putc_gta03(char c)
static __attribute__ (( section (".steppingstone") )) void putc_gta03(char c)
{
serial_putc_s3c64xx(GTA03_DEBUG_UART, c);
}

View File

@ -42,13 +42,15 @@ SECTIONS
__steppingstone :
AT (0)
{
src/cpu/s3c6410/start.o (.text .rodata* .data)
src/cpu/s3c6410/start_qi.o (.text .rodata* .data)
src/cpu/s3c6410/serial-s3c64xx.o (.text .rodata* .data)
src/cpu/s3c6410/gta03.o (.text .rodata* .data)
src/cpu/s3c6410/hs_mmc.o (.text .rodata* .data)
src/utils.o (.text .rodata* .data)
src/ctype.o (.text .rodata* .data)
src/cpu/s3c6410/start.o (.text .rodata* .data .bss)
src/cpu/s3c6410/start_qi.o (.text .rodata* .data .bss)
src/cpu/s3c6410/serial-s3c64xx.o (.text .rodata* .data .bss)
src/cpu/s3c6410/gta03.o (.text .rodata* .data .bss)
src/cpu/s3c6410/hs_mmc.o (.text .rodata* .data .bss)
src/utils.o (.text .rodata* .data .bss)
src/memory-test.o (.text .rodata* .data .bss)
src/ctype.o (.text .rodata* .data .bss)
* (.steppingstone)
}
. = ALIGN(4);

View File

@ -79,6 +79,7 @@ void start_qi(void)
/* okay, do the critical port and serial init for our board */
this_board->port_init();
set_putc_func(this_board->putc);
/* stick some hello messages on debug console */
@ -97,7 +98,7 @@ void start_qi(void)
if (!is_jtag) {
/*
* We got the first 4KBytes of the bootloader pulled into the
* We got the first 8KBytes of the bootloader pulled into the
* steppingstone SRAM for free. Now we pull the whole bootloader
* image into SDRAM.
*

View File

@ -23,10 +23,14 @@
#include <qi.h>
#include <string.h>
static u8 malloc_pool[100 * 1024];
void * malloc_pointer = &malloc_pool[0];
static void (*putc_func)(char) = NULL;
void set_putc_func(void (*p)(char))
{
putc_func = p;
}
size_t strlen(const char *s)
{
size_t n = 0;
@ -88,7 +92,7 @@ char *strchr(const char *s, int c)
int puts(const char *string)
{
while (*string)
this_board->putc(*string++);
(putc_func)(*string++);
return 1;
}
@ -97,9 +101,9 @@ int puts(const char *string)
void printnybble(unsigned char n)
{
if (n < 10)
this_board->putc('0' + n);
(putc_func)('0' + n);
else
this_board->putc('a' + n - 10);
(putc_func)('a' + n - 10);
}
void print8(unsigned char n)
@ -122,13 +126,13 @@ void hexdump(unsigned char *start, int len)
while (len > 0) {
print32((int)start);
this_board->putc(':');
this_board->putc(' ');
(putc_func)(':');
(putc_func)(' ');
for (n = 0; n < 16; n++) {
print8(*start++);
this_board->putc(' ');
(putc_func)(' ');
}
this_board->putc('\n');
(putc_func)('\n');
len -= 16;
}
}
@ -152,7 +156,7 @@ void printdec(int n)
int div = 0;
if (n < 0) {
this_board->putc('-');
(putc_func)('-');
n = -n;
}
@ -163,7 +167,7 @@ void printdec(int n)
n -= d[div];
}
if (r || flag || (d[div] == 1)) {
this_board->putc('0' + r);
(putc_func)('0' + r);
flag = 1;
}
div++;