Jump to content

Photo

Assembling and Linking workshop/move with vasm and vlink

vasm vlink aln mac madmac workshop move

3 replies to this topic

#1 rocky1138 OFFLINE  

rocky1138

    Space Invader

  • 45 posts
  • Location:Canada

Posted Sun May 21, 2017 2:55 PM

In Belboz's workshop zip file there's a "move" example which moves a Jaguar logo around the screen. The attached tarball lets you assemble and link it using `vasm` and `vlink` instead of the more traditional methods.

 

I'm having a lot of fun getting these workshops and other sample codebases to work with the new assembler and linker.

 

No idea what the license is on Belboz's tools. I'd like to include a LICENSE file in this tarball, but can't yet.



#2 rocky1138 OFFLINE  

rocky1138

    Space Invader

  • Topic Starter
  • 45 posts
  • Location:Canada

Posted Sun May 21, 2017 3:23 PM

See attached.

Attached Files



#3 toarnold OFFLINE  

toarnold

    Space Invader

  • 37 posts

Posted Mon May 22, 2017 1:33 AM

Well done!

Please let me give you a small suggestion. You define a STADDR but this address is never used.

This can be done with parameter -Ttext $(STADDR) but this will be ignored by the linker, because you are using the jagsrv format. In this case you have to define your own linker script, otherwise vlink uses an interal linker script which looks like 

  SECTIONS {
    . = 0x4000;
    .text: {
      *(.text CODE text)
    }
    . = ALIGN(32);
    .data: {
      VBCC_CONSTRUCTORS
      *(.data DATA data)
    }
    . = ALIGN(32);
    .bss: {
      *(.bss BSS bss)
      *(COMMON)
      _BSS_END = ALIGN(32);
    }
  };

In case your code should run in the rom area $80200 you can move the text segment. But be aware to move data and bss segment in the ram area $4000. Than pass this new linker script with parameter -T

 

Greetings,

toarnold


Edited by toarnold, Mon May 22, 2017 2:21 AM.


#4 rocky1138 OFFLINE  

rocky1138

    Space Invader

  • Topic Starter
  • 45 posts
  • Location:Canada

Posted Mon May 22, 2017 10:49 PM

Well done!

Please let me give you a small suggestion. You define a STADDR but this address is never used.

This can be done with parameter -Ttext $(STADDR) but this will be ignored by the linker, because you are using the jagsrv format. In this case you have to define your own linker script, otherwise vlink uses an interal linker script which looks like 

  SECTIONS {
    . = 0x4000;
    .text: {
      *(.text CODE text)
    }
    . = ALIGN(32);
    .data: {
      VBCC_CONSTRUCTORS
      *(.data DATA data)
    }
    . = ALIGN(32);
    .bss: {
      *(.bss BSS bss)
      *(COMMON)
      _BSS_END = ALIGN(32);
    }
  };

In case your code should run in the rom area $80200 you can move the text segment. But be aware to move data and bss segment in the ram area $4000. Than pass this new linker script with parameter -T

 

Greetings,

toarnold

 

Such a good catch. Thanks toarnold! Since I'm fine with the `jagsrv` format, I'll probably just remove the unused Makefile variable.







Also tagged with one or more of these keywords: vasm, vlink, aln, mac, madmac, workshop, move

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users