We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The x230.a51 has org 0000h. I assumed that the linker would put this section here. There are several other C files. Here are various snippets.
BL51 BANKED LINKER/LOCATER V5.03, INVOKED BY: C:\KEILC51\C51\BIN\BL51.EXE x230.obj, spdlim.obj, version.obj, app.obj, isruart.obj, vectors.obj TO x230 RAMSIZE (256) INPUT MODULES INCLUDED: x230.obj (X230) from x230.a51 spdlim.obj (SPDLIM) from .C of same name version.obj (VERSION) from .C of same name app.obj (APP) from .C of same name isruart.obj (ISRUART) from .C of same name vectors.obj (VECTORS) from .C of same name LINK MAP OF MODULE: x230 (X230) TYPE BASE LENGTH RELOCATION SEGMENT NAME ----------------------------------------------------- * * * * * * * D A T A M E M O R Y * * * * * * * REG 0000H 0008H ABSOLUTE "REG BANK 0" REG 0008H 0008H ABSOLUTE "REG BANK 1" 0010H 0099H *** GAP *** IDATA 00A9H 0029H ABSOLUTE * * * * * * * C O D E M E M O R Y * * * * * * * CODE 0000H 001EH UNIT ?PR?SERINT?VECTORS CODE 001EH 0005H UNIT ?PR?SPEED_LIMIT_RESET?SPDLIM CODE 0023H 0003H ABSOLUTE CODE 0026H 2F5DH UNIT CS CODE 2F83H 06C4H UNIT ?CO?ISRUART CODE 3647H 014EH UNIT ?PR?PROCESSMSG?APP CODE 3795H 0097H UNIT ?PR?IS_OK_INC_DTARGET_SPD?SPDLIM CODE 382CH 003EH UNIT ?PR?_LOADMSG?ISRUART CODE 386AH 002EH UNIT ?PR?ISR_SER_TX?VECTORS CODE 3898H 0025H UNIT ?PR?ISR_SER_RX?VECTORS
CS SEGMENT CODE RSEG CS RSEG CS org 000h Ljmp powerup ; External 0 falling edge interrupt org 003h reti ; Timer 0 interrupt org 00bh Ljmp timer0_interrupt_service ; External 1 falling edge interrupt org 013h reti ; Timer 1 interrupt org 01bh reti ; Serial interrupt service ; See serint() in vectors.c ; Timer 2 interrupt org 02bh reti ; PCA interrupt org 033h reti
#pragma REGISTERBANK ( 1 ) void serint( void ) interrupt 4 using 1 { isr_ser_rx(); isr_ser_tx(); } void isr_ser_rx( void ) { // rx isr (cut) } void isr_ser_tx( void ) { // tx isr (cut) }
How about changing snippet from x230.a51 to:
CSEG AT 000h Ljmp powerup ; External 0 falling edge interrupt CSEG AT 003h reti ; Timer 0 interrupt CSEG AT 00bh Ljmp timer0_interrupt_service ; External 1 falling edge interrupt CSEG AT 013h reti ; Timer 1 interrupt CSEG AT 01bh reti ; Serial interrupt service ; See serint() in vectors.c ; Timer 2 interrupt CSEG AT 02bh reti ; PCA interrupt CSEG AT 033h reti
"Options for all *.c are to generate SRC file" Why?? If you want to write in 'C', leave it in 'C' - the tools are designed to work that way, and might well make a better job if you let them...
I agree that your suggestion is the preferred method. I get a bunch of L16 (uncalled segment) warnings. However, I see PUBLICs for these entry points in the SRC and I have EXTRN for them in the A51. Thanks, Doug
When you want to use DATA OVERLAYING or CODE BANKING with Assembler / C files you need to structure your assembler code as explained in: http://www.keil.com/appnotes/docs/apnt_149.asp Otherwise you may use the NOOVERLAY linker directive to disable the WARNING 16 messages.
That is, why isn't CS (from x230.a51) at 0000h? Because ORG statements in relocatable segments do not specify ABSOLUTE addresses. From the assembler manual: If the ORG statement occurs in an absolute segment, the location counter is assigned the absolute address value. If the ORG statement occurs in a relocatable segment, the location counter is assigned the offset of the specified expression. Jon