It's driving me crazy... It has taken me a while to install MPLAB IDE, creating an assembly project, include and modify the source files, and at the end I get an error when linking the project:
Probably I'm doing something wrong, but I do not know what it is.
Any help will be very welcome.
Kind regards.
Jes.
My apologies, I did not tell all the details.
To try the interrupts stuff I would like to use a PIC18F45K50 that is inside a Pinguino board (an open project that was left unattended since 2017, and that I keep one board). It is interesting because it has an USB interface and a bootloader, so I thought to upload FF on it without affecting the basic structure.
According the docs for the PIC18 family, I have to create a MPLAB project with ff-pic18.asm and link the FF_USB_xxxx.lib (being xxxx=0800 because the bootloader). I have also to define USB_CDC in the configuration file (p18f24k50-25k50-45k50.cfg) and use the FF_USB_0800.lkr file and define CONFIG_RESET 0x0800 in p18f-main.cfg.
I've also found out that is necessary to assemble usb_cdc.asm.
When asking MPLAB to make the project it returns an error message telling "section 'FF_INT_HI' has a memory 'codeih' which can not fit the absolute section. Section 'FF_INT_HI' start=0x00000008, length=0x0000232e." that is beyond my knowledge, but looking in the net it seems there is a max size for code sections and that should be splitted. Or I have some misunderstanding and I have done some wrong assumption :(
If no other way possible, I would try to assemble, link and flash the non-bootloader version, but it will take me more time because my programmer and other tools are sitting in a box in the garage since the last move (a few years ago).
Anyway, I got the Arduino UNO version running (thanks, Mikael!) by now, and I'll will be learning FF with it by now. A great platform for microcontroller development.
I tried your fix and the build doesn't give that error anymore, but a new one appeared:
MPLINK 4.49, Linker
Device Database Version 1.14
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - section 'FORTH_VARS' has a memory 'acs_ram' which can not fit the section. Section 'FORTH_VARS' length=0x0000002f.
Errors : 1
And looking for acs_ram in the linker USB+bootloader file:
ACCESSBANKNAME=acs_ramSTART=0x10END=0x38PROTECTED
But in the linker USB not bootloader the definition is bigger:
ACCESSBANKNAME=acs_ramSTART=0x10END=0x3FPROTECTED
If I change the END=0x38 by 0X3F and the START of the next line by 0x40, I get a new error:
MPLINK 4.49, Linker
Device Database Version 1.14
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - section '.code' can not fit the section. Section '.code' length=0x0000027a
Errors : 1
Not able to guess anything else ;)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
well, no luck :(
It seems to upload okay, but the usb-win32 device does not show up on the Device Manager as it does when in upload mode. Let me check the specs of the Pinguino bootloader...
Last edit: Jesito 2019-12-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I gave up on this by now, I was blind to see anything with my current setup.
So I decided to recover my boxes from the garage. I found a box with a lot of nice PICs there, my old programmer/ICSP (wisp628). Took the dust off and tried to program the 45K50 without a bootloader but my programmer's firmware is too old and does not recognize the chip. Went to Voti.nl and found a new firmware version, but it does need the 16f648A instead of the current 16f628A. Ordered a couple from eBay. In the meantime it arrives, I thought on using another chip from the lot I found at the garage. There were a couple of 18F458. According the datasheets, these need a TTL-RS232 converter. Found a MAX232 as well, so I put hands to work and buit a small board on perf pads. First power, then MAX232. Tried with a loopback and from Putty seems to work.
Next, I wired the processor and the ICSP connection. Not working. To debug it I took out the processor and placed it in a prototype board I have with all the connections ready. I wanted to test the processor with a simple LED blinking on RA1 to ensure the ICSP and the processor are fine.
Then comes the next question: I have a 20Mhx xtal. In the configuration files of the FF projects, the default clock seems to be 48Mhz, (this might well be due to the use of a 12Mhz xtal and using a PLLx4 feature). But I cannot find any place where to specify I am not going to use the PLLx4 feature...
#if CONFIG_RESET == 0x0000
config OSC = HS
config OSCS = OFF
config PWRT = ON
config BOR = OFF
config WDT = ON
config WDTPS = 128
config STVR = ON
config LVP = OFF
config WRT0 = ON
config WRTB = ON
config WRTC = ON
#endif
that seemed the configuration bits I was looking for.
According the data sheet, the PLLx4 feature is called HS4. To test it I put OSC = HS4 but it gave me a nice error....
Keep trying.
A picture of the board:
Trying to identify the bootloader problem: (why my PIC18F45K50 Pinguino
does not load ff properly)
I've found out that the Pinguino bootloader takes 3k, whilst
ff+usb+bootloader runs from 0x0800 (2k).up
So that's why it didn't work: the bootloader didn't allow to overwrite
itself, so from 0800 to 0C00 the ff code was not loaded...
(that's what I've assumed so far).
Anyway, the small board with the PIC18F458+UART works very well., so I'm
not in a hurry (just curious to make it work)..
On the other hand, I don't have a clear idea about when inline/inlined should be
used. What I read is inlining is to br used to write relocatable asm code,
but I can't think of when this will be convenient or why,
So far, just blinking leds and beeping sounders, and a lot of reading.
thanks for such a nice and funny environment, Mikael!
It's driving me crazy... It has taken me a while to install MPLAB IDE, creating an assembly project, include and modify the source files, and at the end I get an error when linking the project:
Probably I'm doing something wrong, but I do not know what it is.
Any help will be very welcome.
Kind regards.
Jes.
Probably you are using the wrong linker file.
Use FF_USB_0000.lkr
My apologies, I did not tell all the details.
To try the interrupts stuff I would like to use a PIC18F45K50 that is inside a Pinguino board (an open project that was left unattended since 2017, and that I keep one board). It is interesting because it has an USB interface and a bootloader, so I thought to upload FF on it without affecting the basic structure.
According the docs for the PIC18 family, I have to create a MPLAB project with ff-pic18.asm and link the FF_USB_xxxx.lib (being xxxx=0800 because the bootloader). I have also to define USB_CDC in the configuration file (p18f24k50-25k50-45k50.cfg) and use the FF_USB_0800.lkr file and define CONFIG_RESET 0x0800 in p18f-main.cfg.
I've also found out that is necessary to assemble usb_cdc.asm.
When asking MPLAB to make the project it returns an error message telling "section 'FF_INT_HI' has a memory 'codeih' which can not fit the absolute section. Section 'FF_INT_HI' start=0x00000008, length=0x0000232e." that is beyond my knowledge, but looking in the net it seems there is a max size for code sections and that should be splitted. Or I have some misunderstanding and I have done some wrong assumption :(
If no other way possible, I would try to assemble, link and flash the non-bootloader version, but it will take me more time because my programmer and other tools are sitting in a box in the garage since the last move (a few years ago).
Anyway, I got the Arduino UNO version running (thanks, Mikael!) by now, and I'll will be learning FF with it by now. A great platform for microcontroller development.
Last edit: Jesito 2019-12-21
Just built the non-bootloader version and it seems okay, no errors.
Maybe I have to begin afresh again...
I am sorry, I have broken the linker script by using absolute adresses in sorce file.
Need to fix that.
Can be used as a quick fix, or check how to refer to linker sections from the code.
No problem :)
I tried your fix and the build doesn't give that error anymore, but a new one appeared:
Looking in the files;
And looking for acs_ram in the linker USB+bootloader file:
But in the linker USB not bootloader the definition is bigger:
If I change the END=0x38 by 0X3F and the START of the next line by 0x40, I get a new error:
Not able to guess anything else ;)
Try these changes to the linker file
Success!!!
Now I'll try to upload it to the 18F45K50...
Thanks a lot!
well, no luck :(
It seems to upload okay, but the usb-win32 device does not show up on the Device Manager as it does when in upload mode. Let me check the specs of the Pinguino bootloader...
Last edit: Jesito 2019-12-21
I gave up on this by now, I was blind to see anything with my current setup.
So I decided to recover my boxes from the garage. I found a box with a lot of nice PICs there, my old programmer/ICSP (wisp628). Took the dust off and tried to program the 45K50 without a bootloader but my programmer's firmware is too old and does not recognize the chip. Went to Voti.nl and found a new firmware version, but it does need the 16f648A instead of the current 16f628A. Ordered a couple from eBay. In the meantime it arrives, I thought on using another chip from the lot I found at the garage. There were a couple of 18F458. According the datasheets, these need a TTL-RS232 converter. Found a MAX232 as well, so I put hands to work and buit a small board on perf pads. First power, then MAX232. Tried with a loopback and from Putty seems to work.
Next, I wired the processor and the ICSP connection. Not working. To debug it I took out the processor and placed it in a prototype board I have with all the connections ready. I wanted to test the processor with a simple LED blinking on RA1 to ensure the ICSP and the processor are fine.
Then comes the next question: I have a 20Mhx xtal. In the configuration files of the FF projects, the default clock seems to be 48Mhz, (this might well be due to the use of a 12Mhz xtal and using a PLLx4 feature). But I cannot find any place where to specify I am not going to use the PLLx4 feature...
in P18Fxxxx.cfg the 18F458 definitions are:
so I went to p18fxx2xx8.cfg and saw:
that seemed the configuration bits I was looking for.
According the data sheet, the PLLx4 feature is called HS4. To test it I put OSC = HS4 but it gave me a nice error....
Keep trying.
A picture of the board:
With a 20 MHz crystal this should work.
Thanks a lot! Going to try it.
El vie., 3 ene. 2020 9:03, Mikael Nordman oh2aun@users.sourceforge.net
escribió:
Success!!
Thanks a lot for all the help, Markus!.
Now I have to put it in a box and start working :)
On Fri, Jan 3, 2020 at 10:26 AM Jesito jesito@users.sourceforge.net wrote:
Trying to identify the bootloader problem: (why my PIC18F45K50 Pinguino
does not load ff properly)
I've found out that the Pinguino bootloader takes 3k, whilst
ff+usb+bootloader runs from 0x0800 (2k).up
So that's why it didn't work: the bootloader didn't allow to overwrite
itself, so from 0800 to 0C00 the ff code was not loaded...
(that's what I've assumed so far).
Anyway, the small board with the PIC18F458+UART works very well., so I'm
not in a hurry (just curious to make it work)..
On the other hand, I don't have a clear idea about when
inline/inlined should be
used. What I read is inlining is to br used to write relocatable asm code,
but I can't think of when this will be convenient or why,
So far, just blinking leds and beeping sounders, and a lot of reading.
thanks for such a nice and funny environment, Mikael!