Reply
Highlighted
Posts: 13
Registered: ‎03-14-2017
Accepted Solution

Change Start Adress for C8051

Hi

I am new in Silicon labs MCU. I did a MCU project of C8051F340 and I am looking to change the start address of my application. I saw that there is an option of use a custom Linker script in settings; however, I couldn't find an example of a linker script in the folder 8051. 

 

My question is how can I change the space and address of memory for my app in Simplicity IDE. I need it because I want to put a Bootloader that call to my application code. 

 

My debug and release folder don't have .ld and I think that is for that I am using a Keil 8051 tool

Posts: 7,951
Registered: ‎08-13-2003

Re: Change Start Adress for C8051

[ Edited ]

1) you can't change the start address it is hardware defined

2) by using relocate http://www.keil.com/support/docs/189.htm you generate code that assumes another address bank for interrupt vectors and start DO note that just willy nilly doing this will put jumps in the hardware vector sector

lots of info on bootloaders

http://www.silabs.com/support/resources.p-microcontrollers_8-bit-mcus?query=bootloader

 

erik
<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero</font></font> </a> jmg
Posts: 1,107
Registered: ‎04-27-2004

Re: Change Start Adress for C8051


... I did a MCU project of C8051F340 and I am looking to change the start address of my application. 

..I need it because I want to put a Bootloader that call to my application code. 


You might want to look at the EFM8UB2, which has bootloader included.

There is also Silabs source code for EFM8 boot loaders, and that shows how to manage boot offsets for the loader itself.

Also note, the EFM8 series have a special exit reset to boot code feature, so that you do not need to modify your 0-based code when loading via boot.

 

here is the UART ASM start-boot decision tree..

; Bootloader entry point (boot_vector)
    RSEG    ?BL_START
?C_STARTUP:
    USING   0

; Start bootloader if reset vector is not programmed
    MOV     DPTR,#00H
    CLR     A
    MOVC    A,@A+DPTR
    CPL     A
    JZ      boot_start

; Start bootloader if software reset and R0 == signature
    MOV     A,RSTSRC
    CJNE    A,#010H,pin_test
    MOV     A,R0
    XRL     A,#BL_SIGNATURE
    JZ      boot_start

; Start the application by jumping to the reset vector
app_start:
    LJMP    00H

; Start bootloader if POR|Pin reset and boot pin held low
pin_test:
    ANL     A,#03H                  ; A = RSTSRC
    JZ      app_start               ; POR or PINR only
    MOV     R0,#(BL_PIN_LOW_CYCLES / 7)
?C0001:                             ; deglitch loop
    JB      BL_START_PIN,app_start  ; +3
    DJNZ    R0,?C0001               ; +4 = 7 cycles per loop

; Setup the stack and jump to the bootloader
boot_start:
    MOV     SP, #?BL_STACK-1
    LJMP    ?C_START
Posts: 13
Registered: ‎03-14-2017

Re: Change Start Adress for C8051

erikm, It just I need. A way to assign a new location for interrupt vectors. Thank you. 

Posts: 428
Registered: ‎01-18-2004

Re: Change Start Adress for C8051


NorbertoJ wrote:

erikm, It just I need. A way to assign a new location for interrupt vectors. Thank you. 


On the 8051, the interrupt vectors are fixed. What you probably need to do is to change the locations to which each vector points. I don't know how you'd do that.

Posts: 298
Registered: ‎09-22-2009

Re: Change Start Adress for C8051

You could check out the thread here on how to write the code to move the interrupt vectors:

 

http://www.keil.com/forum/6306/

 

However, as people have mentioned, I don't think the hardware supports this, but you could give it a try.

Posts: 428
Registered: ‎01-18-2004

Re: Change Start Adress for C8051


Alan_S wrote:

You could check out the thread here on how to write the code to move the interrupt vectors:

 

http://www.keil.com/forum/6306/

 

However, as people have mentioned, I don't think the hardware supports this, but you could give it a try.


The thing with the 8051 is that the hardware interrupt vectors are fixed to the locations at the bottom of memory. As we know, each vector is a three-byte thing and you're supposed to put an LJMP to the actual interrupt handler address. The Keil compiler deftly handles this (it's what the Interrupt Number is all about); the trick would be to have the bootloader code put new addresses in those locations.

 

Or, you could do what I did when I wrote a firmware update thing for an F120 -- just not use interrupts at all. My updater used a UART, which I polled.

Posts: 7,951
Registered: ‎08-13-2003

Re: Change Start Adress for C8051

my take

 

 just not use interrupts at all.for the bootloader My updater used a UART, which I polled.

 

if yu choose that option it is imperative that the vector section ( 0x0000 - ....) be part of the app easily solved by having the bootloader high

erik