Jump to content

error compiling c app


moxi
 Share

Recommended Posts

  • Replies 106
  • Created
  • Last Reply

Top Posters In This Topic

i've re-do all the work from scratch, and the only error i get now are:

.objs\aout.asm:598:Error [103] syntax error

.objs\aout.asm:600:Error [113] Symbol not previously defined (reg).

.objs\aout.asm:600:Error [113] Symbol not previously defined (reg).

.objs\aout.asm:600:Error [113] Symbol not previously defined (bit).

.objs\aout.asm:605:Error [145] Unmatched ENDM.

.objs\aout.asm:606:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:607:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:608:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:609:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:610:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:611:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:612:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:613:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:614:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:615:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:616:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:617:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:618:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:619:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:620:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:621:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

any suggestion?

Link to comment
Share on other sites

aout.c:267:19: warning: no newline at end of file

this one is pretty easy: just make a new line at the end of the file, so that the file does not end with a char but a blank line!

aout.c:185: syntax error: token -> 'void' ; column 10

could you post a snippet (maybe lines 180 to 190) of aout.c?

cheers,

AC

Link to comment
Share on other sites

thanks  i've solved this first errors.

now i get this one:

aout.c:213: syntax error: token -> '' ; column 0

Process terminated with status 1 (0 minutes, 1 seconds)

1 errors, 0 warnings

here is a quote of the 4 last line of my file:

210:      bcf    CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK ; release latch

211:endasm;

213;  }

214:

 

Link to comment
Share on other sites

here is my file in this last state, i've added all the code needed (i think):

/////////////////////////////////////////////////////////////////////////////

#include "cmios.h"

#include "pic18f452.h"

#include "main.h"

#include "aout.h"

/////////////////////////////////////////////////////////////////////////////

// Global variables

/////////////////////////////////////////////////////////////////////////////

// AOUT values

unsigned int aout_value[8];

// stores the last AOUT values (to determine, if the shift registers have to be updated)

unsigned int last_aout_value[8];

// the gate pins

aout_gates_t aout_gates;

// last state of the aout gate flags to determine changes

aout_gates_t last_aout_gates;

/////////////////////////////////////////////////////////////////////////////

// This function initializes the AOUT module

/////////////////////////////////////////////////////////////////////////////

void CV_AOUT_LC_Init(void) {

__asm

;; enable pin drivers

bcf CV_AOUT_LC_TRIS_RCLK, CV_AOUT_LC_PIN_RCLK

bcf CV_AOUT_LC_TRIS_DOUT, CV_AOUT_LC_PIN_DOUT

bcf CV_AOUT_LC_TRIS_SCLK, CV_AOUT_LC_PIN_SCLK

;; set voltages to 0V

lfsr FSR0, AOUT0_L

movlw 8

movwf MIOS_PARAMETER3 ; used as loop counter here

CV_AOUT_LC_InitVoutLoop

clrf POSTINC0

movlw 0x80

movwf POSTINC0

decfsz MIOS_PARAMETER3, F

rgoto CV_AOUT_LC_InitVoutLoop

;; update the AOUT pins

rcall CV_AOUT_LC_Update

return

__endasm;

}

void CV_AOUT_LC_Load2SR(void) {

    __asm

        bcf    CV_AOUT_LC_LAT_SCLK, CV_AOUT_LC_PIN_SCLK ; clear clock

;; superfast transfer with unrolled loop (takes some memory, but guarantees the

;; lowest system load :)

CV_AOUT_LC_WRITE_BIT MACRO reg, bit

bcf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT ; set out pin depending on register content (reg.bit)

btfsc reg, bit

bsf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT

nop

        bsf    CV_AOUT_LC_LAT_SCLK, CV_AOUT_LC_PIN_SCLK ; rising clock edge

        bcf    CV_AOUT_LC_LAT_SCLK, CV_AOUT_LC_PIN_SCLK ; falling clock edge

ENDM

CV_AOUT_LC_WRITE_BIT TMP1, 7

CV_AOUT_LC_WRITE_BIT TMP1, 6

CV_AOUT_LC_WRITE_BIT TMP1, 5

CV_AOUT_LC_WRITE_BIT TMP1, 4

CV_AOUT_LC_WRITE_BIT TMP1, 3

CV_AOUT_LC_WRITE_BIT TMP1, 2

CV_AOUT_LC_WRITE_BIT TMP1, 1

CV_AOUT_LC_WRITE_BIT TMP1, 0

CV_AOUT_LC_WRITE_BIT TMP2, 7

CV_AOUT_LC_WRITE_BIT TMP2, 6

CV_AOUT_LC_WRITE_BIT TMP2, 5

CV_AOUT_LC_WRITE_BIT TMP2, 4

CV_AOUT_LC_WRITE_BIT TMP2, 3

CV_AOUT_LC_WRITE_BIT TMP2, 2

CV_AOUT_LC_WRITE_BIT TMP2, 1

CV_AOUT_LC_WRITE_BIT TMP2, 0

;; this must be done once all SRs in the chain have been uploaded!

#if 0

        bsf    CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK ; latch SID values

bcf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT ; clear out pin (standby)

        bcf    CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK ; release latch

#endif

__endasm;

}

void CV_AOUT_LC_LoadAOUTx_8_8(void)

{

__asm

;; 8bit/8bit

swapf PREINC1, W ; AOUT0_H[3:0] -> TMP2[7:4]

andlw 0xf0

movwf TMP2

movf POSTDEC1, W ; AOUT0_L

swapf INDF1, W ; AOUT0_L[7:4] -> TMP2[3:0]

andlw 0x0f

iorwf TMP2, F

movf POSTINC1, W ; AOUT0_H

movf POSTINC1, W ; AOUT1_L

swapf PREINC1, W ; AOUT1_H[3:0] -> TMP1[7:4]

andlw 0xf0

movwf TMP1

movf POSTDEC1, W ; AOUT1_L

swapf INDF1, W ; AOUT1_L[7:4] -> TMP1[3:0]

andlw 0x0f

iorwf TMP1, F

bsf POSTINC1, 7 ; AOUT1_H

movf POSTDEC1, W ; AOUT1_L

movf POSTDEC1, W ; AOUT0_H

bsf INDF1, 7 ; AOUT0_H

movf POSTDEC1, W ; AOUT0_L

rgoto _CV_AOUT_LC_Load2SR

__endasm;

}

// --------------------------------------------------------------------------

//  FUNCTION: CV_AOUT_LC_Update

//  DESCRIPTION: refreshes the AOUT pins if AOUT values have been changed

//  OUT:  -

//  USES: TMP[12345] and MIOS_PARAMETER[12]

// --------------------------------------------------------------------------

void CV_AOUT_LC_Update(void) {

__asm

;; check if any output has to be updated

IFCLR AOUT0_H, 7, rgoto CV_AOUT_LC_Update_SRs

IFCLR AOUT1_H, 7, rgoto CV_AOUT_LC_Update_SRs

IFCLR AOUT2_H, 7, rgoto CV_AOUT_LC_Update_SRs

IFCLR AOUT3_H, 7, rgoto CV_AOUT_LC_Update_SRs

IFCLR AOUT4_H, 7, rgoto CV_AOUT_LC_Update_SRs

IFCLR AOUT5_H, 7, rgoto CV_AOUT_LC_Update_SRs

IFCLR AOUT6_H, 7, rgoto CV_AOUT_LC_Update_SRs

IFCLR AOUT7_H, 7, rgoto CV_AOUT_LC_Update_SRs

rgoto _CV_AOUT_LC_Update_NoSRs

__endasm;

}

void CV_AOUT_LC_Update_SRs(void) {

__asm

lfsr FSR1, AOUT6_L ; loads AOUT6_[LH] and AOUT7_[LH]

rcall CV_AOUT_LC_LoadAOUTx_8_8

lfsr FSR1, AOUT4_L ; loads AOUT4_[LH] and AOUT5_[LH]

rcall CV_AOUT_LC_LoadAOUTx_8_8

lfsr FSR1, AOUT2_L ; loads AOUT2_[LH] and AOUT3_[LH]

rcall CV_AOUT_LC_LoadAOUTx_8_8

lfsr FSR1, AOUT0_L ; loads AOUT0_[LH] and AOUT1_[LH]

rcall _CV_AOUT_LC_LoadAOUTx_8_8

        bsf    CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK ; latch SID values

bcf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT ; clear out pin (standby)

        bcf    CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK ; release latch

__endasm;

}

i've added properly the __asm and endasm; for each parts...now the reports tell me that a lot of symbol are not defined (MIOS_PARAMETER3,POSTINC0,INDF1...)it's like the asm code was not integrated correctly... :(

Link to comment
Share on other sites

as the snippet has just 193 lines, I expect the error has been before...

let's see what looks suspicious:

- line 54: you should move the [tt]return[/tt] after the [tt]__endasm; [/tt]==>

[tt]__endasm;

return;

}[/tt]

- line 93: [tt]#if 0[/tt]

if 0 will never be true and therefore will never be processed? is that okay?

in cases like these, there might be an error in the header file?

besides the "return;" I can see no syntax error.

[tt]MIOS_PARAMETER3[/tt] is declared in cmios.h wich is included correctly. let's see if that [tt]return; [/tt]solves it...

Link to comment
Share on other sites

there is only header text before, this is the full file..

your hint don't solve the problems, here is a quote of the errors reports:

.objs\aout.asm:216:Error [108] Illegal Character (,)

.objs\aout.asm:216:Error [128] Missing argument(s).

.objs\aout.asm:217:Error [113] Symbol not previously defined (CV_AOUT_LC_LoadAOUTx_8_8).

.objs\aout.asm:218:Error [108] Illegal Character (,)

.objs\aout.asm:218:Error [128] Missing argument(s).

.objs\aout.asm:219:Error [113] Symbol not previously defined (CV_AOUT_LC_LoadAOUTx_8_8).

.objs\aout.asm:220:Error [108] Illegal Character (,)

.objs\aout.asm:220:Error [128] Missing argument(s).

.objs\aout.asm:221:Error [113] Symbol not previously defined (CV_AOUT_LC_LoadAOUTx_8_8).

.objs\aout.asm:222:Error [108] Illegal Character (,)

.objs\aout.asm:222:Error [128] Missing argument(s).

.objs\aout.asm:224:Error [128] Missing argument(s).

.objs\aout.asm:225:Error [128] Missing argument(s).

.objs\aout.asm:226:Error [128] Missing argument(s).

.objs\aout.asm:237:Error [103] syntax error

.objs\aout.asm:238:Error [103] syntax error

.objs\aout.asm:239:Error [103] syntax error

.objs\aout.asm:240:Error [103] syntax error

.objs\aout.asm:241:Error [103] syntax error

.objs\aout.asm:242:Error [103] syntax error

.objs\aout.asm:243:Error [103] syntax error

.objs\aout.asm:244:Error [103] syntax error

.objs\aout.asm:245:Error [174] Unknown opcode "rgoto"

.objs\aout.asm:256:Warning [203] Found opcode in column 1.

.objs\aout.asm:257:Error [103] syntax error

.objs\aout.asm:260:Error [113] Symbol not previously defined (TMP2).

.objs\aout.asm:260:Error [113] Symbol not previously defined (TMP2).

.objs\aout.asm:262:Warning [203] Found opcode in column 1.

.objs\aout.asm:262:Error [113] Symbol not previously defined (INDF1).

.objs\aout.asm:262:Error [113] Symbol not previously defined (INDF1).

.objs\aout.asm:263:Error [103] syntax error

.objs\aout.asm:266:Error [113] Symbol not previously defined (TMP2).

.objs\aout.asm:266:Error [113] Symbol not previously defined (TMP2).

.objs\aout.asm:267:Error [113] Symbol not previously defined (POSTINC1).

.objs\aout.asm:267:Error [113] Symbol not previously defined (POSTINC1).

.objs\aout.asm:268:Error [113] Symbol not previously defined (POSTINC1).

.objs\aout.asm:268:Error [113] Symbol not previously defined (POSTINC1).

.objs\aout.asm:269:Warning [203] Found opcode in column 1.

.objs\aout.asm:270:Error [103] syntax error

.objs\aout.asm:273:Error [113] Symbol not previously defined (TMP1).

.objs\aout.asm:273:Error [113] Symbol not previously defined (TMP1).

pic16_allocRegByName:963 symbol name _aout_value regop= 00000000

.objs\aout.asm:275:Warning [203] Found opcode in column 1.

pic16_allocRegByName:963 symbol name _last_aout_value regop= 00000000

.objs\aout.asm:275:Error [113] Symbol not previously defined (INDF1).

pic16_allocRegByName:963 symbol name _aout_gates regop= 00000000

.objs\aout.asm:275:Error [113] Symbol not previously defined (INDF1).

pic16_allocRegByName:963 symbol name _last_aout_gates regop= 00000000

.objs\aout.asm:276:Error [103] syntax error

.objs\aout.asm:279:Error [113] Symbol not previously defined (TMP1).

.objs\aout.asm:279:Error [113] Symbol not previously defined (TMP1).

.objs\aout.asm:280:Error [113] Symbol not previously defined (POSTINC1).

.objs\aout.asm:280:Error [113] Symbol not previously defined (POSTINC1).

.objs\aout.asm:283:Error [113] Symbol not previously defined (INDF1).

.objs\aout.asm:283:Error [113] Symbol not previously defined (INDF1).

.objs\aout.asm:285:Error [174] Unknown opcode "rgoto"

.objs\aout.asm:295:Error [128] Missing argument(s).

.objs\aout.asm:298:Error [103] syntax error

.objs\aout.asm:299:Error [128] Missing argument(s).

.objs\aout.asm:300:Error [113] Symbol not previously defined (reg).

.objs\aout.asm:300:Error [113] Symbol not previously defined (reg).

.objs\aout.asm:300:Error [113] Symbol not previously defined (bit).

.objs\aout.asm:301:Error [128] Missing argument(s).

.objs\aout.asm:303:Error [128] Missing argument(s).

.objs\aout.asm:304:Error [128] Missing argument(s).

.objs\aout.asm:305:Error [145] Unmatched ENDM.

.objs\aout.asm:306:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:307:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:308:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:309:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:310:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:311:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:312:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:313:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:314:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:315:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:316:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:317:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:318:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:319:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:320:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:321:Error [174] Unknown opcode "CV_AOUT_LC_WRITE_BIT"

.objs\aout.asm:323:Error [128] Missing argument(s).

.objs\aout.asm:324:Error [128] Missing argument(s).

.objs\aout.asm:325:Error [128] Missing argument(s).

.objs\aout.asm:336:Error [128] Missing argument(s).

.objs\aout.asm:337:Error [128] Missing argument(s).

.objs\aout.asm:338:Error [128] Missing argument(s).

.objs\aout.asm:340:Error [108] Illegal Character (,)

.objs\aout.asm:340:Error [128] Missing argument(s).

.objs\aout.asm:342:Error [113] Symbol not previously defined (MIOS_PARAMETER3).

.objs\aout.asm:342:Error [113] Symbol not previously defined (MIOS_PARAMETER3).

.objs\aout.asm:343:Error [174] Unknown opcode "CV_AOUT_LC_InitVoutLoop"

.objs\aout.asm:344:Error [113] Symbol not previously defined (POSTINC0).

.objs\aout.asm:344:Error [113] Symbol not previously defined (POSTINC0).

.objs\aout.asm:346:Error [113] Symbol not previously defined (POSTINC0).

.objs\aout.asm:346:Error [113] Symbol not previously defined (POSTINC0).

.objs\aout.asm:347:Error [113] Symbol not previously defined (MIOS_PARAMETER3).

.objs\aout.asm:347:Error [113] Symbol not previously defined (MIOS_PARAMETER3).

.objs\aout.asm:348:Error [174] Unknown opcode "rgoto"

.objs\aout.asm:350:Error [113] Symbol not previously defined (CV_AOUT_LC_Update).

where have I to define this symbols?

Link to comment
Share on other sites

Moxi,

you just have to care about the very first errors. Most time the rest of the errors are a result of the first one.

An illegal character is reported right before CV_AOUT_LC_LoadAOUTx_8_8, if I count these line-numbers (113) up to 108, this brings us straight to your "#if 0" thing.

please remove this completely from the code and compile again:

   
;; this must be done once all SRs in the chain have been uploaded!
#if 0
        bsf     CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK   ; latch SID values
   bcf   CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT   ; clear out pin (standby)
        bcf     CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK   ; release latch
#endif

When I think about it, it seems very likely that C-preprocessor directors are not supported in ASM codesnippets!

I bet this is it!

Link to comment
Share on other sites

I tried to build this on my system.  It appears that the error is

occurring here:

[tt]

lfsr FSR1, AOUT6_L ; loads AOUT6_[LH] and AOUT7_[LH]

[/tt]

There is no preprocessor definition for AOUT6_L as far as I can see.

It's in aout.h but in a section the is ifdef'd out.  Am I off base here?

Link to comment
Share on other sites

have you created a proper makefile?

you must open MAKEFILE.SPEC in an editor and add this line right below l:39 (MK_SET_OBJ pic18f452.c main.c)

[tt]MK_ADD_OBJ aout.c[/tt]

more entries if you have more files like aout.c...

then save and open up your console (DOS promt or terminal)

change directory to the /tools dir and call

[tt]mkmk.pl (path to MAKEFILE.SPEC here)[/tt]

then you should see this output:

[tt]Makefile generated.

Makefile.bat generated.[/tt]

then call [tt]make[/tt] from the directory of your sources.

I could compile these files without any error:

[tt]Block 003000-0033FF allocated - Checksum: 16

Block 003400-0037FF allocated - Checksum: 60[/tt]

Link to comment
Share on other sites

There is no preprocessor definition for AOUT6_L as far as I can see.

It's in aout.h but in a section the is ifdef'd out.  Am I off base here?

:)

good point, but I just discovered a tiny "#endif", so this should be alright...

as it did indeed compile on my computer, I think moxi forgot to add aout.c to the makefile, so there's some important stuff missing for the compiler or linker or whatever...

but these #if 0 parts seem indeed a bit cheesy to me... and if they compile, yet they don't seem to improve readability... just my 2c...

cheers ,)

Michael

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share


×
×
  • Create New...