• AVR Freaks

Hot!Has anyone used the toolchain "pic-as" in 2.20

Author
stenakew
Starting Member
  • Total Posts : 34
  • Reward points : 0
  • Joined: 2013/09/04 10:54:16
  • Location: 0
  • Status: offline
2020/05/28 15:43:43 (permalink)
0

Has anyone used the toolchain "pic-as" in 2.20

Hej.
A fresh Win 10 computer (no older Microchip tools installed)
Using MPLABX 5.40 and XC8 2.20
Curiosity (LPC) and a PIC16F1829
 
Starting a new project and selecting "pic-as (v2.20) [C:\Program Files\Microchip\xc8\v2.20\pic-as\bin]" as "Compiler Toolchain"
Without adding some files to the project, I select menu item "Window/Target Memory Views/Configuration Bits".
 
But it is not possible to change any configuration bits.
If I hit “Generate Source Code to Output” I get “Verify Compiler Toolchain highlighted: pic-as (v2.20) [C:\Program Files\Microchip\xc8\v2.20\pic-as\bin] : 2.20”
Ignoring the pic-as Compiler Toolchain and instead using XC.
Then, after some struggling, I managed to create a pure assembler program.
 
Selected
  • “Do not link startup module in”
  • “Link in C library” to “None”
In “XC8 Linker / Option categories / Runtime”
 
The project consisted of 3 files
 

;LED_1829_Basic_B.inc
 
    global  LED_Init
    global  LED4_On
    global  LED4_Off
   

 

;LED_1829_Basic_B.asm
   
#include    <xc.inc>
#include    "LED_1829_Basic_B.inc"
 
#define          LED4_TRIS   TRISA
#define          LED4_LAT    LATA
#define          LED4_BIT    5
   
PSECT LED, class="CODE", delta=2
                
LED_Init:
    banksel      LED4_LAT
    bcf          LED4_LAT, LED4_BIT
    banksel      LED4_TRIS
    bcf          LED4_TRIS, LED4_BIT
    return
   
LED4_On:
    banksel      LED4_LAT
    bsf          LED4_LAT, LED4_BIT
    return
   
LED4_Off:
    banksel      LED4_LAT
    bcf          LED4_LAT, LED4_BIT
    return

 

;main_1829_Basic_B.asm
 
#include <xc.inc>
#include "LED_1829_Basic_B.inc"
   
;configuration
CONFIG FOSC=INTOSC
CONFIG WDTE=OFF,PWRTE=OFF
CONFIG MCLRE=ON
CONFIG CP=OFF,CPD=OFF
CONFIG BOREN=ON
CONFIG CLKOUTEN=OFF
CONFIG IESO=OFF
CONFIG FCMEN=OFF
CONFIG WRT=OFF
CONFIG PLLEN=OFF
CONFIG STVREN=ON
CONFIG BORV=LO
CONFIG LVP=ON
 
PSECT reset_Vec,class=CODE,delta=2
resetVec:
    PAGESEL start
    goto start
 
PSECT udata
delay_ms:            ds 1
delay_ms_counter:    ds 1
 
PSECT int_Vec,class=CODE,delta=2
intVec:
    retfie
 
PSECT code
start:
    call    LED_Init
   
main_loop:
    call    LED4_On
    movlw   200
    call    Delay_ms
    call    LED4_Off
    movlw   200
    call    Delay_ms
    goto    main_loop
 
;----------------------------
;delay a number of ms
;
;entry W = number of ms
;exit  -
   
#define     DELAY_MS_COUNT  40
 
Delay_ms:
    banksel delay_ms
    movwf   delay_ms
Delay_ms_1:
    movlw   DELAY_MS_COUNT
    movwf   delay_ms_counter
Delay_ms_2:
    decfsz  delay_ms_counter, F
    goto    Delay_ms_2
    decfsz  delay_ms, F
    goto    Delay_ms_1
    return
 
;Some PSECT's requested by the linker, but newer used
PSECT powerup,class=CODE,delta=2
PSECT cinit,class=CODE,delta=2
PSECT functab,class=CODE,delta=2
PSECT eeprom_data, class="EEDATA",delta=2
 
END resetVec

 
I also had to add 2 PSECT definitions to the linkers “Additional options”. (Also added the option to generate a map file.)
 
-Wl,-Map=mapfile.map -Wl,-preset_Vec=0h -Wl,-pint_Vec=4h
 
Is there any other way using MPLABX 5.40 and XC8 2.20 to create a pure assembler program?
 
 
 
#1

4 Replies Related Threads

    sdn_
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2020/03/08 02:14:28
    • Location: 0
    • Status: offline
    Re: Has anyone used the toolchain "pic-as" in 2.20 2020/05/30 00:42:43 (permalink)
    +1 (1)
    I also created a test project for PIC18 on PIC-AS. For me it consists of only one file. For debugging, I needed the contents of the listing.disasm file, however it does not contain a disassembler. Show what you have in this file? If nothing, then the microchip seriously complicates the development of programs for 8 bit microcontrollers in assembly language.
    #2
    dan1138
    Super Member
    • Total Posts : 3625
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Has anyone used the toolchain "pic-as" in 2.20 2020/05/30 14:30:22 (permalink)
    +3 (3)
    I ported your LED blinky app into a pic-as assembly project template I created.

    It builds using the pic-as(v2.20) "Compiler Toolchain", other than not being able to change the configuration words using the IDE interface it seem to run.

    To get debug working is a whole different bucket of bait.

    I have not been able to get the IDE to do source level debug when using the pic-as(v2.20) "Compiler Toolchain".

    Using a hack to start such a debug session by "importing" the ELF output from a debug build into a "prebuilt" MPLABX project runs, but the simulator stopwatch does not work.

    <rant>
    How the simulator works (or fails to work) with the MPLABX IDE is nuttier than squirrel poo.

    I know programming with assembly language tends to get weird but, Microchip seems to have mixed in a lot of chopped stupid with this release.
    </rant>
    #3
    sdn_
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2020/03/08 02:14:28
    • Location: 0
    • Status: offline
    Re: Has anyone used the toolchain "pic-as" in 2.20 2020/05/30 14:51:16 (permalink)
    0
    ASM16 (XC16) has an output listing.disasm and a normal simulator (as it was in MPASM). Therefore, i think that the microchip will later add these functions to pic-as .
    #4
    dan1138
    Super Member
    • Total Posts : 3625
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Has anyone used the toolchain "pic-as" in 2.20 2020/05/30 15:20:29 (permalink)
    +1 (1)
    sdn_
    ASM16 (XC16) has an output listing.disasm and a normal simulator (as it was in MPASM). Therefore, i think that the microchip will later add these functions to pic-as .

    It seems my point was not made clearly enough.
     
    The XC8 compiler for C language works now with source level debug. The final output from the C compiler comes for the pic-as tool.
     
    But then source level debug is not available when using the pic-as(v2.20) "Compiler Toolchain". This suggests that the IDE is ignoring the source level debug provided by the pic-as assembler. Perhaps in favor of the C language debug symbols. These will not be present as the C compiler is not used for this tool chain.
     
    It appears that the pic-as assembler produces source level debug symbols because MPLABX IDE will use them when a prebuilt ELF file is imported from a pic-as assembly project.
    post edited by dan1138 - 2020/06/01 13:25:58
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5