Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 04, 2012, 10:24:39 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Join our IRC channel: ##psp-programming on freenode
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: elf to prx question  (Read 2347 times)
sauron_le_noir
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 4
471.42 points

View Inventory
Send Money to sauron_le_noir

View Profile
« on: August 30, 2009, 01:59:22 PM »

Hello i'm very debutant with mips for psp. I've play around with spim to learn mips asm and now i will make a hello world in psp mips. I use psp-as to produce a elf file but as read from many forum cf > 1.5 need prx and not elf
so there is my question. What kind of flag must you pass to psp-asto generate static elf and what kind of section must be declared to use psp-prxgen.

Here is my skeleton program. It does not yet do something just save variable on the stack restore the variable on the statck a jump to value found in register ra
Here is the program. As read in the tutorial from anissian i have declared a start entry, a module info
and a section sceModuleInfo.
i use psp-as helloworld.s -o helloworld.elf to generate the elf.
When i use psp-fixup-imports -v helloworld.elf i saw that the type is  001 and not 0002

Magic 464C457F, Class 01, Data 01, Idver 01
Type 0001, Machine 0008, Version 00000001, Entry 00000000
Phoff 00000000, Shoff 000001B8, Flags 10A20001, Ehsize 00000034
Phentsize 0000, Phnum 0000
Shentsize 0028, Shnum 00000013, Shstrndx 0010
Error, not EXEC type elf

here is the program

   .set       noreorder
      .text
      .global    _start
      .ent       _start
_start:
      addiu       $sp, -0x10
      sw      $ra, 0($sp)   
      sw      $s0, 4($sp)
      sw      $s1, 8($sp)

      lw      $ra, 0($sp)
      lw      $s0, 4($sp)
      lw      $s1, 8($sp)
      move      $v0, $0
      jr       $ra
      addiu      $sp, 0x10

      .end _start
.section   .lib.ent,"wa",@progbits
__lib_ent_top:
      .word 0
      .word 0x80000000
      .word 0x00010104
      .word __entrytable


      .section   .lib.ent.btm,"wa",@progbits
__lib_ent_bottom:
      .word   0


      .section   .lib.stub,"wa",@progbits
__lib_stub_top:


      .section   .lib.stub.btm,"wa",@progbits
__lib_stub_bottom:
      .word   0


##############################################################################

      .section   ".rodata.sceModuleInfo","a",@progbits

module_info:
      .word      0x01011006
      .ascii      "HELLOW"      #up to 28 char
      .align   5
      .word   _gp
      .word   __lib_ent_top
      .word   __lib_ent_bottom
      .word   __lib_stub_top
      .word   __lib_stub_bottom

##############################################################################

      .section   .rodata.entrytable,"a",@progbits
__entrytable:
      .word 0xD632ACDB
      .word 0xF01D73A7
      .word _start
      .word module_info
      .word 0



###############################################################################

      .data
      .global g_elf_name
g_elf_name: .word 0
      .global g_elf_namesize
g_elf_namesize: .word 0
      .global g_sr
g_sr:      .word 0

###############################################################################

      .bss

« Last Edit: August 30, 2009, 02:33:22 PM by sauron_le_noir » Logged


sauron_le_noir
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 4
471.42 points

View Inventory
Send Money to sauron_le_noir

View Profile
« Reply #1 on: August 31, 2009, 12:21:45 AM »

Ok i'm very newbie or i have  drink to much alcool.
I forgot to link edit the program.

What are the switch that i must use to link edit correctly a program for a psp currently i use
psp-ld main.o -o main.elf. How must you declare the .text section so psp-fiximport can handle correctly
your program. after link edit i've got this error

[f731@port39 helloworld]$ psp-fixup-imports -v main.elf
Loading main.elf, outputting to main.elf
Magic 464C457F, Class 01, Data 01, Idver 01
Type 0002, Machine 0008, Version 00000001, Entry 08900018
Phoff 00000034, Shoff 0000124C, Flags 10A20001, Ehsize 00000034
Phentsize 0020, Phnum 0001
Shentsize 0028, Shnum 0000000F, Shstrndx 000C

Section 0:
Name 00000000, Type 00000000, Flags 00000000, Addr 00000000
Offset 00000000, Size 00000000, Link 00000000, Info 00000000
Addralign 00000000, Entsize 00000000 pData (nil)

Section 1: .reginfo
Name 0000001B, Type 70000006, Flags 00000000, Addr 08900000
Offset 000011AC, Size 00000018, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000001 pData 0x8af031c

Section 2: .text
Name 00000024, Type 00000001, Flags 00000006, Addr 08900018
Offset 00001018, Size 00000028, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000000 pData 0x8af0188

Section 3: .lib.ent
Name 0000002A, Type 00000001, Flags 00000003, Addr 08900040
Offset 00001040, Size 00000010, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000000 pData 0x8af01b0

Section 4: .lib.ent.btm
Name 00000033, Type 00000001, Flags 00000003, Addr 08900050
Offset 00001050, Size 00000004, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000000 pData 0x8af01c0

Section 5: .lib.stub
Name 00000040, Type 00000001, Flags 00000003, Addr 08900054
Offset 00001054, Size 00000000, Link 00000000, Info 00000000
Addralign 00000001, Entsize 00000000 pData 0x8af01c4

Section 6: .lib.stub.btm
Name 0000004A, Type 00000001, Flags 00000003, Addr 08900054
Offset 00001054, Size 00000004, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000000 pData 0x8af01c4

Section 7: .rodata.sceModuleInfo
Name 00000058, Type 00000001, Flags 00000002, Addr 08900058
Offset 00001058, Size 00000034, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000000 pData 0x8af01c8

Section 8: .rodata
Name 0000006E, Type 00000001, Flags 00000002, Addr 0890008C
Offset 0000108C, Size 00000014, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000000 pData 0x8af01fc

Section 9: .data
Name 00000076, Type 00000001, Flags 00000003, Addr 089001A0
Offset 000011A0, Size 0000000C, Link 00000000, Info 00000000
Addralign 00000004, Entsize 00000000 pData 0x8af0310

Section 10: .sbss
Name 0000007C, Type 00000008, Flags 10000003, Addr 089001AC
Offset 000011C4, Size 00000000, Link 00000000, Info 00000000
Addralign 00000001, Entsize 00000000 pData 0x8af0334

Section 11: .bss
Name 00000082, Type 00000008, Flags 00000003, Addr 089001AC
Offset 000011AC, Size 00000000, Link 00000000, Info 00000000
Addralign 00000001, Entsize 00000000 pData 0x8af031c

Section 12: .shstrtab
Name 00000011, Type 00000003, Flags 00000000, Addr 00000000
Offset 000011C4, Size 00000087, Link 00000000, Info 00000000
Addralign 00000001, Entsize 00000000 pData 0x8af0334

Section 13: .symtab
Name 00000001, Type 00000002, Flags 00000000, Addr 00000000
Offset 000014A4, Size 00000200, Link 0000000E, Info 00000015
Addralign 00000004, Entsize 00000010 pData 0x8af0614

Section 14: .strtab
Name 00000009, Type 00000003, Flags 00000000, Addr 00000000
Offset 000016A4, Size 000000B0, Link 00000000, Info 00000000
Addralign 00000001, Entsize 00000000 pData 0x8af0814
ELF Load Base address 08900018
Error, no stub text section found
Logged
Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.152 seconds with 23 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com