Rodata on Raspberry Pi

I am trying to make a simple printf function on my bare metal OS for Raspberry Pi.

The function is empty right now:

int kprintf(const char *string, ...) { } 

I can currently draw on the screen. However, when calling this function, problems arise. As a test, I draw a few characters on the screen before calling kprintf.

If I use:

 kprintf ("HELLO"); 

The screen is blank. However, if I use:

 kprintf ("HE"); 

Everything is good. The only thing I can think of right now is the problem with the script linker. Perhaps the section of Rodat.

I am using a modified script builder from Cambridge RPi tutorials:

 STARTUP(crt0.o) SECTIONS { .init 0x8000 : { *(.init) } .text 0x8080 : { *(.text) *(.rodata) } .data : { *(.data) } .bss : { *(.bss) *(COMMON) } /DISCARD/ : { *(*) } } 

Any ideas?

+4
source share
1 answer

FYI seems OK if I use this linker script:

 STARTUP(crt0.o) SECTIONS { .init 0x8000 : { *(.init) } .text 0x9000 : { *(.text) *(.rodata) *(COMMON) } .data : { *(.data) } .bss : { *(.bss) } /DISCARD/ : { *(*) } } 

Hope this helps someone else in the future

0
source

All Articles