[SeaBIOS] Question about linker building seabios

Kevin O'Connor kevin at koconnor.net
Sat Jan 15 17:26:51 CET 2011


On Sat, Jan 15, 2011 at 10:56:43AM +0100, Marc Bertens wrote:
> Hi Kevin,

Hi - see below.

> 
> I'm adding a VT100 serial console to the seabios code. 
> Which can be set to port COM1 or COM2. 
> I added the interrupt vector in the serial_setup() routine. 
> And made the interrupt service routine. The compiling goes 
> fine, no problems there. But in the linking stage an error 
> is reported to the line of the interrupt service routine: 
> 
> make
>   Compiling whole program out/ccode.16.s
>   Compiling (16bit) out/code16.o
>   Compiling whole program out/ccode32flat.o
>   Building ld scripts (version "pre-0.6.2-20110115_103541-mbertens-desktop")
> Fixed space: 0xe05b-0x10000  total: 8101  slack: 15  Percent slack: 0.2%
> 16bit size:           37264
> 32bit segmented size: 2217
> 32bit flat size:      14007
> 32bit flat init size: 38848
>   Linking out/rom16.o
>   Stripping out/rom16.strip.o
>   Linking out/rom32seg.o
>   Stripping out/rom32seg.strip.o
>   Linking out/rom.o
> `.discard.func16.src/serial.c.261' referenced in section `.text.init_hw.54839' of out/code32flat.o: defined in discarded section `.discard.func16.src/serial.c.261' of out/code32flat.o
> make: *** [out/rom.o] Error 1
> 
> Can you tell me what i'm doing wrong or missing to do?
> 
> Below here are the code snippets:
> 
>     // INT(3/4)h : Serial Hardware Service Entry Point (for keyboard
> handling)
>     void VISIBLE16 handle_console_serial( void )
>     {
>         ...    // my code
>         ...
>     done:
>         eoi_pic1();
>     }
> 
> 
>     void
>     serial_setup(void)
>     {
>         ...  // orginal code
>     
>         ...
>         #if CONFIG_KEYBOARD_SERIAL
>             con_addr = GET_BDA( port_com[ CONFIG_KEYBOARD_SERIAL -
> 1 ] );
>             dprintf( 3, "keyboard on serial port %x\n", con_addr ); 
>         # if CONFIG_KEYBOARD_SERIAL == 1 || CONFIG_KEYBOARD_SERIAL == 3 
>             enable_hwirq( 4, FUNC16( handle_console_serial ) );
>         # else
>             enable_hwirq( 3, FUNC16( handle_console_serial ) );
>         # endif

You need to define an assembler stub (see romlayout.S) that calls
handle_console_serial.  Only this assembler stub should be registered
with enable_hwirq().  Looks like you probably just need to add
"DECL_IRQ_ENTRY console_serial", which will allow you do
"enable_hwirq(3, FUNC16(entry_console_serial));"

-Kevin



More information about the SeaBIOS mailing list