News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

16 Bit H and non H registers compiler behavior.

Started by diebobo, Oct 17, 2021, 09:48 AM

Previous topic - Next topic

diebobo

Quote from: charliecoutas on Nov 05, 2021, 04:57 PMdiebobo

Do you use the ADC in the 33CK devices? I am getting "Linker error:'a.o(.text+0x8a).....undefined reference to ad1con3'"


   Dim  adc_result As Word
Main:  adc_result = ADIn 0

Sorry Les if this is my fault.

Not yet, need reliable UART communications to debug my code and perihipial. So awaiting Les his fixes.

diebobo

Quote from: top204 on Nov 04, 2021, 03:40 PMI've ran some RX/TX interrupts on them and they do not give any errors.

Hi Les,

I don't want to keep whining but i really am confident things don't are oke.. I will show you.

The code
Isr U1RXInterrupt
    IFS0bits_U1RXIF = 0
EndIsr

Generates ASM :

    bra _lbli__19
.global __U1TXInterrupt
__U1TXInterrupt:

I guess it means Interruptvector 19, which is correct according to datasheet but the label __U1TXInterrupt is wrong. I know this pretty sure because the following code :

Isr U2RXInterrupt
    IFS0bits_U1RXIF = 0
EndIsr

Generates this :

  bra _lbli__35
.global __SPI2RXInterrupt
__SPI2RXInterrupt:

Which is vector 35, which is also correct according to the datasheet but the label __SPI2RXInterrupt is way of, nothing to do with UART.



The following is from the DEF file :

$define U1RXInterrupt 19
$define U1TXInterrupt 20
$define ECCSBEInterrupt 21
$define NVMInterrupt 22
$define INT1Interrupt 23
$define SI2C1Interrupt 24
$define MI2C1Interrupt 25
$define DMA2Interrupt 26
$define CNCInterrupt 27
$define INT2Interrupt 28
$define DMA3Interrupt 29
$define CCP2Interrupt 31
$define CCT2Interrupt 32
$define C1Interrupt 33
$define INT3Interrupt 34
$define U2RXInterrupt 35
$define U2TXInterrupt 36
$define SPI2RXInterrupt 37
$define SPI2TXInterrupt 38

My first example between coded U1RXInterrupt and generated U1TXInterrupt is difference of 1. My seconde example coded U2RXInterrupt and generated is SPI2RXInterrupt is difference of 2.. I thought it was just an offset of +1 problem but that is not the case..

Perhaps that my UART RX interrupt not working problems are not related to this, since i guess its just a wrongly generated label ? and the Interuptvector is correct.. But yeah, just reporting ;)   

diebobo

Les,

i did some additional testing, for your information..

Def file :

$define OscillatorFail 0
$define AddressError 1
$define HardTrapError 2
$define StackError 3
$define MathError 4
$define ReservedTrap5 5
$define SoftTrapError 6
$define ReservedTrap7 7
$define INT0Interrupt 8
$define T1Interrupt 9
$define CNAInterrupt 10
$define CNBInterrupt 11
$define DMA0Interrupt 12
$define CCP1Interrupt 14
$define CCT1Interrupt 15
$define DMA1Interrupt 16
$define SPI1RXInterrupt 17
$define SPI1TXInterrupt 19
$define U1RXInterrupt 19
$define U1TXInterrupt 20

Up until DMA0Interrupt everything goes wel.. for example code Isr DMA0Interrupt wil result in ASM     bra _lbli__12
.global __DMA0Interrupt
__DMA0Interrupt:

However the very next one in line CCP1Interrupt will generate ASM bra _lbli__14
.global __CCT1Interrupt
__CCT1Interrupt:
which is wrong.. 

Perhaps it has anything to do with that vector 13 is reserverd / blank ? I tried to edit the def file but no luck.. The same happens after position 29 and onwards, that is the next reserverd part ( vector 30 ) .. in my example 2 above that is in that region, so i guess thats why its off bij 2 instead of 1.

For example _CCT4Interrupt gives an offset of 7 !!.. which is correct according my theory because it passes 7 reserverd vectors...

Anyway, for your information..


top204

Many thanks for your detailed explanation of an anomaly.

You are correct with the offsets. The info files that I used to create the interrupt offsets had the non-interrupt offsets blank, so the creator missed them, and the compiler loads them into a StringList so they are referenced by an offset value, and if that offset is incorrect, so is the name, and if the name is incorrect it creates an internal exception, so the the name is not transferred to the assembler code. I have altered the compiler to take this into consideration by also reading the value after the interrupt name in the .ppi file and filling in what is missing, and altered the interrupt offsets in the .ppi and .def files so they pad with dummy interrupt vectors.

It is the linker that uses the name and automatically assigns it to the device's interrupt vector table at the beginning of flash memory.

Also...
I have re-written the HRsinX commands so they operate flawlessly with the dsPIC33xxCK devices. They operate slightly different to other dsPIC33 devices, so it caught me out. I had to read the datasheets a few times to see what was required because they do not have detailed info in them anymore. :-(


diebobo

Looking forward to the update Les, getting some work done and unlock that 100 mips ;)