News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Assembler Errors

Started by Peter Truman, Aug 05, 2024, 07:54 AM

Previous topic - Next topic

Peter Truman

Hi
Compiler 1.0.3.2
IDE 2.0.3.3

I have a program under development with 3779 lines of code (and comments) so far. Working on the code today and I'm not sure what I did!

All worked fine yesterday (I should have saved under a different name today, but I didn't) :-( but, today I'm getting 'ASM Error: Assembler Errors: Hex file not created' there appear to be 5 erros concerned - A.S 831, A.S 891, A.S 891, A.S 891, A.S 891: Argument out of range (32892 not between 0 and 32767 etc) Unfortunately, I I don't know what this means (other than the fact that it looks like 1/2 of a word size variable) and I can't find any way to debug this?  The A.S numbers don't seem to relate to a line number?

Any clues?

Thanks in advance

top204

The line numbers given in an assembler file relate to the assembler code produced by the compiler (Press the F2 button).

So an assembler error of:

Error[113]   C:\USERS\LES\PDS\TESTS\ECORE_14_TESTS\A.S 1834 : Symbol not previously defined (SPBRG)

Means the error is on line 1834 of the assembler code file.

Those types of assembler error are usually where an Org directive has been placed in the code, or some assembler code has been placed, and jumps and calls cannot reach a destination, or the device itself has ran out of flash memory.

Peter Truman

Hi - Thanks for the answer. I wondered if the number represented the location of the problem. But, looking at line 891 in the assembler code I see "GOTO PDESTINATION"

_MGOTO MACRO PDESTINATION
IF (PDESTINATION < 1)
    GOTO PDESTINATION
ELSE
IF (PDESTINATION > $)
    GOTO PDESTINATION
ELSE
IF (PDESTINATION < ($ - 0X03FF))
    GOTO PDESTINATION
ELSE
    BRA PDESTINATION
ENDIF
ENDIF
ENDIF
ENDM

The next question is - how do I relate that back to the *.bas file since the call doesn't use the same name? Is there a way to find that?

There is no doubt that I'm on the edge of running out of space - my revised version compiles at 98.61% or program space with 44.4% of bytes variables used.

I'm going to spend some time refactoring this code to make it a bit more efficient!

Thanks for your response



top204

Do not disable the optimiser, so comment out any Declares for optimisation set for 0 and dead_code_remove set to off or false, and let the compiler perfrom its simple optimisation paths. On enhanced 14-bit core devices and 18F devices, the optimiser is trustworthy in its default settings.

This will remove the macro operations altogether. I can see it is either an enhanced 14-bit core device or an 18F device because the macro has the Bra mnemonic as an option if the destination is within range, whereas the standard 14-bit core devices do not have a Bra mnemonic.

Because it is a Jump macro causing the problem, it seems that the destination is either too far away and the compiler's mechanism has been over-ridden with assembler code, or the device has actually ran out of code memory, but that will normally be treated as a compiler error (with the optimiser enabled or left to its default).

I have a sneaky feeling the device has ran out of code memory. Make sure you do not have an Org directive in the code listing.

Peter Truman

I think you are right - I cleaned up the code (which I was planning to do anyway) and freed up some space (I was very close to the edge to start with) and it seems to be ok now.

I need to do some more optimisation because there is still work to do (feature creep) and I can't easily change PICs - keeping me honest though!

Thanks for your help