Jump to content
rocky1138

Assembling and Linking workshop/move with vasm and vlink

Recommended Posts

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.

  • Like 1

Share this post


Link to post
Share on other sites

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
  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

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...