Hello all and apologies for the length in advance. I'm working on a UART
bootloader for the cc2430. In the longer term it will be co-hosted with
images of the contiki-os.

I started with the info found in the relevant tutorial on the sdcc wiki.
Let me start by saying many many thanks for publishing it, it explains
things very nicely - I'd have no clue where to start otherwise.

So, I downloaded the example from github and built it (for the record
one needs to rename the assembler executable in the makefile first). I
then noticed that the 'magic' VECTOR area was being relocated as well.
>From reading the wiki page, I understand that the whole point is to keep
VECTOR at the start of the code area and relocate everything else. Am I
misunderstanding things or has something perhaps changed in SDCC between
the tutorial and now?

I then made the following changes to the tutorial's crtstart.asm and
tried it with my code:
- I changed VECTOR from (CODE) to (ABS,CODE). 
- I tried with .org 0x0000 as well as without. Both worked
- I tried with the .globl __interrupt_vect directive as well as without.
Again, both worked

My question here is, am I on the right track? Will any of the
combinations above come back and bite me? What's the best way to achieve
things?

One further requirement is that my bootloader needs to be able to use
interrupts. Things didn't work off the shelf so I manually added my ISRs
in crtstart.asm, like:
...
        ljmp    _dma_ISR
        .ds     5
...

Again, things seem to be working but I'd like your comments on whether
this is the recommended way to do it or if I'm playing with fire.

My current crtstart.asm is at the end of the message. If you guys can be
bothered with having a look at it and send your comments, I'd greatly
appreciate it.

One last question is: The user apps will also use interrupts and will
use code banking. Any special requirements in order to co-host it with
the boot loader in addition to the obvious "don't overwrite each other"?
I should think that --code-loc would be enough, so long as the loader is
smart enough to jump to the app's start address?

Thanks ever so much for reading this far and for any replies.
George

crtstart.asm:
==============
    .globl __start__stack
;--------------------------------------------------------
; Stack segment in internal ram
;--------------------------------------------------------
    .area   SSEG    (DATA)
__start__stack:
    .ds 1

    .area VECTOR    (ABS,CODE)
__interrupt_vect:
    ljmp    __sdcc_gsinit_startup
    reti
    .ds     7
    ljmp    _dma_ISR
    .ds     5
    reti
    .ds     7
    reti
    .ds     7
    reti
    .ds     7
    reti
    .ds     7
    ljmp    _port_0_ISR
    .ds     5
    reti
    .ds     7
    ljmp    _port_1_ISR
    .ds     5
    reti
    .ds     7
    ljmp    _watchdog_ISR

    .globl __start__stack

    .area GSINIT0 (CODE)

__sdcc_gsinit_startup::
    mov     sp,#__start__stack - 1

    .area GSFINAL (CODE)
    ljmp    _loader_main


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to