Jump to content
IGNORED

rmac GPU symbols not exported


swapd0

Recommended Posts

Modified the code a bit to be more self contained and assemble:

 

 

BASE            EQU     $F00000 ; TOM Internal Register Base
G_RAM           EQU     BASE + $3000    ; GPU Internal RAM
 
_gpu_code_start::
.gpu
.org G_RAM
 
 
movei #_gpu_sprite,r0
 
 
.long
 
_gpu_sprite:: dc.l 0
Assembled with rmac 1.13.5 using "rmac -fe -l*swapd0.lst swapd0.s". I assume you want elf .o objects. The listing for this looks like:

 

    1           =00F00000               BASE            EQU     $F00000 ; TOM Internal Register Base
    2           =00F03000               G_RAM           EQU     BASE + $3000    ; GPU Internal RAM
    3                                   
    4                                   _gpu_code_start::
    5                                   	.gpu
    6                                   	.org G_RAM
    7                                   
    8                                   
    9  00000000  9800xxxxxxxx           	movei #_gpu_sprite,r0
   10                                   
   11                                   
   12  00000006  0000                   	.long
   13                                   
   14  00000008  00000000               _gpu_sprite::	dc.l 0

              BASE 0000000000F00000  a 
             G_RAM 0000000000F03000  a 
   _gpu_code_start 0000000000000000  tg
       _gpu_sprite 0000000000F03008  ag

Looks like the symbols are tagged as global here. Let's look at the .o file itself:

 

ELF Header

  Class:      ELF32
  Encoding:   Big endian
  ELFVersion: Current
  Type:       Relocatable file
  Machine:    Motorola m68k family
  Version:    Current
  Entry:      0x0
  Flags:      0x0

Section Headers:
[  Nr ] Type              Addr     Size     ES Flg Lk Inf Al Name
[    0] NULL              00000000 00000000 00     00 000 00                   
[    1] PROGBITS          00000000 0000000c 00 AX  00 000 04 .text             
[    2] STRTAB            00000000 00000021 00     00 000 01 .shstrtab         
[    3] SYMTAB            00000000 00000060 10     04 004 04 .symtab           
[    4] STRTAB            00000000 00000028 00     00 000 01 .strtab           
Key to Flags: W (write), A (alloc), X (execute)


Symbol table (.symtab)
[  Nr ] Value    Size     Type    Bind      Sect Name
[    0] 00000000 00000000 NOTYPE  LOCAL        0   
[    1] 00000000 00000000 SECTION LOCAL        1   
[    2] 00f00000 00000000 NOTYPE  LOCAL    65521 BASE 
[    3] 00f03000 00000000 NOTYPE  LOCAL    65521 G_RAM 
[    4] 00000000 00000000 NOTYPE  GLOBAL       1 _gpu_code_start 
[    5] 00f03008 00000000 NOTYPE  GLOBAL       0 _gpu_sprite 

Section Data:
.text
[00000000] 98 00 30 08 00 f0 00 00 00 00 00 00
.shstrtab
[00000000] 00 2e 73 68 73 74 72 74 61 62 00 2e 73 79 6d 74
[00000010] 61 62 00 2e 73 74 72 74 61 62 00 2e 74 65 78 74
[00000020] 00
.symtab
[00000000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[00000010] 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 01
[00000020] 00 00 00 01 00 f0 00 00 00 00 00 00 00 00 ff f1
[00000030] 00 00 00 06 00 f0 30 00 00 00 00 00 00 00 ff f1
.strtab
[00000000] 00 42 41 53 45 00 47 5f 52 41 4d 00 5f 67 70 75
[00000010] 5f 63 6f 64 65 5f 73 74 61 72 74 00 5f 67 70 75
[00000020] 5f 73 70 72 69 74 65 00


Generated by ELFIO (C++ library for ELF file processing)
http://elfio.sourceforge.net/
Again the symbols look global. So as far as I can see it's not rmac's fault. You'll have to tell us some more info like the version of rmac you used, the command line you used, and whether your compiler/linker requires extra undercores (or no underscores at all). Maybe your symbols need to be defined using a double underscore (for example __gpu_sprite). Edited by ggn
  • Like 1
Link to comment
Share on other sites

I'm using rmac 1.12.4

 

List output, looks ok.

swapd0$ cat test.lst 

                                        test.s               Page 1       11:07:22 am 10-Jan-2019        RMAC 1.12.04 (Linux/OSX)


    1           =00F00000               BASE            EQU     $F00000 ; TOM Internal Register Base
    2           =00F03000               G_RAM           EQU     BASE + $3000    ; GPU Internal RAM
    3                                   
    4                                   _gpu_code_start::
    5                                       .gpu
    6                                       .org G_RAM
    7                                   
    8  00000000  9800xxxxxxxx               movei #_gpu_sprite,r0
    9                                   
   10  00000006  0000                       .long
   11                                   
   12  00000008  00000000               _gpu_sprite:: dc.l 0



                                        test.s               Page 2       11:07:22 am 10-Jan-2019        RMAC 1.12.04 (Linux/OSX)
Symbol Table

              BASE 0000000000F00000  a 
             G_RAM 0000000000F03000  a 
   _gpu_code_start 0000000000000000  tg
       _gpu_sprite 0000000000F03008  ag



nm output, _gpu_sprite it's wrong, it should be $f03008

0$ nm test.o
00f00000 a BASE
00f03000 a G_RAM
00000000 T _gpu_code_start
         U _gpu_sprite

I got a linker error telling me that _gpu_sprite it's not defined, but I've no problem with _gpu_code_start, it's weird.

 

Link to comment
Share on other sites

nm output, _gpu_sprite it's wrong, it should be $f03008

0$ nm test.o
00f00000 a BASE
00f03000 a G_RAM
00000000 T _gpu_code_start
         U _gpu_sprite

I got a linker error telling me that _gpu_sprite it's not defined, but I've no problem with _gpu_code_start, it's weird.

 

Here I got

 

nm swapd0.o
00000000 T _gpu_code_start
         U _gpu_sprite
00f00000 a BASE
00f03000 a G_RAM
So, probably update your rmac?
Link to comment
Share on other sites

Updated and it doesn't work, the problem it's that the label it's marked as undefined.

 

To share data between GPU & 68000 I had been using a crap solution that it's to use some low memory address to write some data and the GPU reads from there, for example 0x4000 - 4 stores a pointer to the raster table at Classic Kong.

 

I've been looking at the rmac code, and I've fixed the export to elf with absolute addressing, I've tested with Classic Kong and It works, now I'm using a label at GPU address as the raster pointer.

 

Here it's the fix:

file: object.c

function: uint8_t * AddELFSymEntry(uint8_t * buf, SYM * sym, int globflag)

lines: around 233
old code
	if (w1 & TEXT)
		st_shndx = elfHdrNum[ES_TEXT];
	else if (w1 & DATA)
		st_shndx = elfHdrNum[ES_DATA];
	else if (w1 & BSS)
		st_shndx = elfHdrNum[ES_BSS];
	else if (globflag)
		st_shndx = 0;		// Global, not absolute

new code
	if (w1 & TEXT)
		st_shndx = elfHdrNum[ES_TEXT];
	else if (w1 & DATA)
		st_shndx = elfHdrNum[ES_DATA];
	else if (w1 & BSS)
		st_shndx = elfHdrNum[ES_BSS];
	else if (globflag)
	{
		// not absolute code or it's an extern reference (DEFINED missing)
		if (!orgactive || (w1 & DEFINED) == 0)
			st_shndx = 0;		// Global, not absolute
	}

Link to comment
Share on other sites

To share data between GPU & 68000 I had been using a crap solution that it's to use some low memory address to write some data and the GPU reads from there, for example 0x4000 - 4 stores a pointer to the raster table at Classic Kong.

If you're using shared memory for communication, it's better to use GPU memory, since the GPU can access it without needing the main bus.
  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...