Menu

Bootloader and Inline assembly code

Help
rinthesun
2007-10-02
2013-05-30
  • rinthesun

    rinthesun - 2007-10-02

    I wish to write a bootloader in GCBASIC. What I need is for the ORG assembly directive to be passed thru to the assembler. Right now it generates an error.

    Is there anyway to use the assembler separately?

     
    • kent_twt4

      kent_twt4 - 2007-10-02

      As far as I know, the assembly drops thru to the assembler, so that shouldn't be the problem.  My guess is that the source file for the compiler is not letting you pass the org statement thru.  So until further help arrives....

      Tried the Sparkfun Bloader bootloader from the most recent thread on this issue.  Got a heartbeat back from the bootloader, but could not download a hex file.  Maybe a board issue, maybe not.  In the end, its just easier to do ICSP from my perspective.  If a bootloader was wrapped into an IDE, that might change my mind.

       
    • rinthesun

      rinthesun - 2007-10-02

      ORG does not drop thru, I tried it. Normal assembly codes drops thru, but assembly directives do not.

      I know that changes were made to the compiler for the Scream bootloader, but here is a more elegant solution:

      asm:  org 0x0000
      asm:  bcf pclath,3
      asm:  bcf pclath,4
      goto start
      asm:  org 0x0004
      asm:  retfie
      start:

      Using org will also allow Screamer to work. What I would like is the compiler in a form before this bootloader code at 0x0000 was added and ORG allowed. Making these changes will expand the usefullness of the compiler and leave the user more in control.

      Take a look at Oshonsoft.com which includes a basic compiler. On the same site under projects you will find a bootloader which will work across all the 16F series by simply recompiling, since the loader is written in basic with inline assembly code.

       
    • rinthesun

      rinthesun - 2007-10-02

      One more comment. I compiled the BlinkLED.txt program and downloaded it to a 16F877A using the Oshonsoft bootloader. It worked perfectly except for the code inserted by the compiler. The problem is the Call INITSYS. I realize that I could take the BlinkLED.asm and edit it and use MPLAB assembler or the GCBASIC built in assembler.

       
    • rinthesun

      rinthesun - 2007-10-02

      I now have the Oshonsoft bootloader working with GCBASIC. I compiled the BlinkLED.txt and then edited the compiled.asm file to:

      ORG    0
          bcf pclath,3
          bcf pclath,4
          goto    SystemInitialise

      ;Interrupt vector
          ORG    4
          retfie

      SystemInitialise
          call    INITSYS

      I also used the update.zip mentioned in the bootloader posts that moves the call INITSYS. If the above changes can be made to the compiler we will have another working bootloader.

      I still would like the ORG pass thru so I can write the bootloader with GCBASIC.

       
    • Nobody/Anonymous

      Good job with the bootloadeer.  Threw your org statements in a testled.asm file, also for a 16f877A, and reassembled with MPLAB.  Tried the Screamer again, and still getting an "incorrect response - 0 from the Pic, programming halted" message.  Makes me think the 6ft Prolific usb to serial cable might be an issue, as the Screamer was supposed to work per the other bootloader thread anyways.

       
    • rinthesun

      rinthesun - 2007-10-03

      If you would like to try the oshonsoft.com bootloader you will need to purchase Pic_Sim_IDE for 29euro. This is a great deal since it will compiler 8K code space and has a simulator. The bootloader has complete source in basic though the PC part is done with VB and there is no source. You can recompile it to work with different 16F parts.

       
    • Hugh Considine

      Hugh Considine - 2007-10-06

      Sorry for taking so long to reply, busy week!

      The asm directive now works properly, and can be used to pass ORG through to assembly. For example, to insert ORG 0x240 use this command:

      asm ORG 0x240

      I've also added a new #option parameter: bootloader. If #option bootloader is not specified, the first 4 program memory locations will contain this:

      call INITSYS
      goto SystemInitialise
      -
      -

      If #option bootloader is specified, the first 4 words will be as follows:

      clrf PCLATH
      goto SystemInitialise
      -
      -

      InitSys is then called later on in the program, after the SystemInitialise label.

      These changes are in http://gcbasic.sourceforge.net/newfiles/update.zip

       
    • Nobody/Anonymous

      Hugh, please do me one more favor and under #option bootloader add
         org 4
         retfie

      The bootloader jumps to address 5 and I need to patch the "retfie" and reassemnble each time.

      Thanks

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.