[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
18f c and asm, sdcc only ok, +asm+gplink problem
From: xgpasm ####@####.#### Date: 11 Jan 2013 11:39:52 -0000 Message-Id: <loom.20130111T114737-299@post.gmane.org> Hi aLl, I'm lost, i've spend time on this, i'm sure i've forget something basic, but i cant' figure out ! Sorry for my crap description below, but i don't know howto explain it. Compilation using the Makefile show no error, but the program is not working. If i use only sdcc with no -c flag (command below), the main it's work perfectly, but no asm is include, -c flag effect. sdcc -I/usr/share/sdcc/include/pic16 -I./include -I./lib -I./ -mpic16 -p18f2455 --verbose uart18f.c When i link using the Makefile to existing asm code, the program is not working and gpsim show this error : gpsim -c uart18f.stc Read: 0x0000 from REG000(0x0000) Wrote: 0x0000 to postdec1(0x0FE5) was 0x0000 Wrote: 0x00D3 to fsrl1(0x0FE1) was 0x00D4 Wrote: 0x000F to fsrh1(0x0FE2) was 0x000F Invalid Trace entry: 0x0 I see that the program didn't start where i need to start, i mean, in the source memory view, the cursor is never moving, but something is running in background....very strange.. FYI...I'm using this Makefile for different other code using 16f arch, but in 18f it fail. Any help would be very appreciated...thanks in advance xgpasm Version : sdcc -v SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Feb 3 2010) (UNIX) gpasm -v gpasm-0.13.7 beta gplink -v gplink-0.13.7 beta Makefile : ========== INCLUDE=-I/usr/share/sdcc/include/pic16 -I./include -I./lib -I./ PROCESSOR_FLAG=-mpic16 PROCESSOR_TYPE=-p18f2455 CC=sdcc AS=gpasm PROC=-Dpic18f2455i PROC_FLAG=-D__18f2455i CFLAGS=-c --verbose LNK=gplink INC=-I/usr/share/sdcc/lib/pic16 LKR=-s/usr/share/gputils/lkr/18f2455i.lkr LIBPROC=/usr/share/sdcc/lib/pic16/libdev18f2455.lib /usr/share/sdcc/lib/pic16/libio18f2455.lib /usr/share/sdcc/lib/pic16/libc18f.lib LIBSDCC=/usr/share/sdcc/lib/pic16/libsdcc.lib LIBM=/usr/share/sdcc/lib/pic16/libm18f.lib HEX_FILES=uart18f.hex all: clean $(HEX_FILES) %.hex: %.c $(CC) $(INCLUDE) $(PROCESSOR_FLAG) $(PROCESSOR_TYPE) $(CFLAGS) $< # $(AS) $(PROC) $(PROC_FLAG) -c $*.asm -o $*.o $(AS) $(PROC) $(PROC_FLAG) -c lib/utils2.asm -o utils2.o $(LNK) $(INC) $(LKR) -d -m -c -o $* uart18f.o utils2.o $(LIBPROC) $(LIBPROC1) $(LIBSDCC) clean: $(RM) *.asm *.cod *.lst *.hex *.p *.d *.lnk *~ usart18f.c ========== #pragma stack 0x200 0xff /* (<- always first line in main.c) */ #define __18F2455i #include <pic18f2455.h> #include <uart18f.h> #include <utils2.h> #include <stdio.h> #include <usart.h> code char at 0x300000 CONFIG1L = 0x24; // USB, /2 post (48MHz), /5 pre (20 MHz) code char at 0x300001 CONFIG1H = 0x0c;// IESO=0, FCMEN=0, HS (20MHz) code char at 0x300002 CONFIG2L = 0x20;// Brown out off, PWRT On code char at 0x300003 CONFIG2H = 0x00;// WDT off code char at 0x300004 CONFIG3L = 0xff;// Unused configuration bits code char at 0x300005 CONFIG3H = 0x01; // No MCLR, PORTB digital, CCP2 - RC1 code char at 0x300006 CONFIG4L = 0x80;// ICD off, ext off, LVP off, stk ovr off void initUsart() { usart_open( // Use USART library to initialise the hardware USART_TX_INT_OFF & USART_RX_INT_OFF & USART_BRGH_HIGH & USART_ASYNCH_MODE & USART_EIGHT_BIT, 129 ); stdout = STREAM_USART; stdin = STREAM_USART; } // // Main program : // void main(void) { unsigned long loop=0; OSCCON = 0x60; /* 0011 0000 */ TRISB=0b10101001; // TRISA=0b00010111; // All analog input TRISCbits.TRISC7 = 1; // RX (1:input) TRISCbits.TRISC6 = 1; // TX (0:output) initUsart(); printf("Init done\n"); loop=0; while ( loop == 0) { if (usart_drdy()) { unsigned char rxByte; _asm clrwdt _endasm; rxByte = usart_getc(); usart_putc(rxByte); if (rxByte == 'x') { printf("Ho oui tu m'excites!!!\n"); loop = 1; } } } } utils2.asm ========== PROCESSOR 18f2455 Radix DEC EXPAND #include "p18f2455.inc" ; Include header file UDATA CBLOCK 0x060 ; Send 232 cycl_1, cycl_2, Byte, rxData ; ----------- ;TOTAL 3 byte d'usage general ; ----------- ENDC OledIn equ 7 ; Rxd <- Txd oled OledOut equ 6 ; Txd -> Rxd oled CODE ;********************************************************** ; Timer pour 1 bit ; 115000 Bps _rs115bps movlw D'8' movwf cycl_2 _rs115wait ; 4 cycles nop decfsz cycl_2, 1 goto _rs115wait return ;********************************************************** ; Timer de 1/2 bit ; 115000 Bps ; 3 x 200ns x 3 = 1.8us _rs115half movlw D'3' movwf cycl_2 _rs115half2 nop ; 4 cycles decfsz cycl_2 , f goto _rs115half2 return GLOBAL _RX_Oled,_Send_Oled end uart18f.h ========= extern void Send_Oled(unsigned char c); extern unsigned char RX_Oled(void); FOR GPSIM ========== uart18f.conf ============ # Module libraries: module library libgpsim_modules.so # Modules: # pic18f2455i.CONFIG=$ff pic18f2455.WarnMode=true pic18f2455.SafeMode=true pic18f2455.UnknownMode=true pic18f2455.BreakOnReset=true pic18f2455.BreakOnInvalidRegisterRead=true pic18f2455.BreakOnInvalidRegisterWrite=true pic18f2455.frequency=20000000.000000000 pic18f2455.xpos=144.0000000000000 pic18f2455.ypos=192.0000000000000 module load usart U1 U1.rxbaud=9600 U1.txbaud=9600 U1.rx=13 U1.tx=0 U1.crlf=true U1.loop=false U1.console=true U1.xpos = 300 U1.ypos = 192 # Connections: # receive from xbee node n_xbee_rx attach n_xbee_rx portc7 U1.TXPIN # transmit to xbee node n_xbee_tx attach n_xbee_tx portc6 U1.RXPIN uart18f.stc # ----------- myproject.stc --------------- load s uart18f.cod frequency 20000000 load c uart18f.conf # ----------------------------------------- Sorry for the spam ;-)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |