Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
16F87 BL compile issues ? [solved]
#1
Question 
I found a previous thread where it set to delte the Enhanced 16F defines and uncomment the Standard 16F defines.
My defines were in the ds30Loader.asm not the settings.inc file
I don't see any Standard defines just the 16F Enhanced ???

They were ...
;---------------------------------------------------------------------; Extended PIC16F
;--------------------------------------------------------------------- ifndef EEDATL
#define EEDATL EEDATA ;;;;;;;;;;;;;;;;;;;;;
endif
ifndef INDF
#define INDF_ INDF0
else
#define INDF_ INDF
endif
ifndef FSR
#define FSR_ FSR0L
#ELSE
#define FSR_ FSR
endif

ifndef PMCON1
#define EECON1_ EECON1 ;;;;;;;;;
#define EECON2_ EECON2 ;;;;;;;;;
#define EEDATL_ EEDATL
#define EEDATH_ EEDATH ;;;;;;;;;
#define EEADRL_ EEADRL
#define EEADRH_ EEADRH ;;;;;;;;;
else
#define EECON1_ PMCON1
#define EECON2_ PMCON2
#define EEDATL_ PMDATL
#define EEDATH_ PMDATH
#define EEADRL_ PMADRL
#define EEADRH_ PMADRH
endif
;------------------------------------------------------------------
ifndef EEADRL
#define EEADRL EEADR ; Bug Fix ??????????????????????
endif


I added the define above and it compiled. However when I download the BL i can't get the chip to talk to the PC gui

any thoughts ????

Just as an fyi the hardware setup works fine if I program the chip with the notinybld16F88.HEX and use the Tiny BL gui.
Reply
#2
Thanks for the bug report.

Is the oscillator and configuration words setup correctly?
Reply
#3
(2011-09-09, 23:06:25)Mikael Gustafsson Wrote: Thanks for the bug report.

Is the oscillator and configuration words setup correctly?

Yes I am sure the oscillator and config is set correctly.
What was the old non-enhanced 16F defines ? Can you post a copy ?

Thanks,
Kevin
Reply
#4
The PIC16F87 device is not an enhance PIC16. Thos are usually four number like PIC16F1936.
Post your settings.inc and tell us which oscillator you use.

Mikael
Reply
#5
(2011-09-10, 11:58:23)Mikael Gustafsson Wrote: The PIC16F87 device is not an enhance PIC16. Thos are usually four number like PIC16F1936.
Post your settings.inc and tell us which oscillator you use.
Mikael

I am using INTRC_IO (the internal at 8Mhz and I/O)
The only things I changed were

LIST P=16F87
#define FOSC 8000000 was 16000000
#define BAUDRATE 19200 was 9600

I need to recheck the config
_FOSC_HS <<< I think this was changed to INTRC_IO
_WDT_OFF
_PWRT_OFF
_MCLR_ON
_BODEN_OFF <<< was boren
_IESO_OFF
_FCMEN_OFF
_LVP_OFF
_PLL_ON <<< not sure on this one I don't think it is defined on the F87


Thanks for your time I appreciate the help !!!
Reply
#6
This is what I used ....

_CONFIG1, _INTRC_IO & _WDT_OFF & _PWRTE_OFF & _MCLR_ON &

_BODEN_OFF & _IESO_OFF & _FCMEN_OFF

_CONFIG2, _LVP_OFF & _DEBUG_OFF
Reply
#7
See section 4.3 in ds30 Loader firmware manual.

The internal rc oscillator defaults to 31.25 kHz on start-up. You need to configure it.
Read the oscillator section in the data sheet.

Mikael
Reply
#8
OK, so the config is now this .....
__CONFIG _CONFIG1, _INTRC_IO & _WDT_OFF & _PWRTE_OFF & _MCLR_ON & _BODEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _LVP_OFF & _DEBUG_OFF & _CPD_OFF & _WRT_PROTECT_OFF & _CP_OFF

I uncommented this section

; Set internal oscillator to 8MHz
banksel OSCCON
bsf OSCCON, IRCF0 ;bank 1
bsf OSCCON, IRCF1
bsf OSCCON, IRCF2

Would not fit in 192 so I had to change to 256

#define BLPLW 256 was 192
BL placement, words from end, should be a multiple of 64


Reply
#9
When I download the latest version and assemble there are more than 20 words available. 192 should be enough.
Reply
#10
I set the bootloader pagesize to 8 and said it was 8 pages from the end.
Is that right the code sizw BLPLW was set to 256 ?

0000 00237 org 0x0000
0000 158A 00238 PAGESEL blstart
0001 2F00 00239 goto blstart
00240
00241
00242 ;-------------------------------------
00243 ; GOTO user application
00244 ;-------------------------------------
0EFD 00245 org STARTADDR - 3;space to deposit goto to user application
0EFD 00246 loadusr
0EFD 0000 00247 nop ;page select, replaced by gui
0EFE 0000 00248 nop ;page select, replaced by gui
MPASM 5.42 DS30LOADER.ASM 9-11-2011 14:08:25 PAGE 18

This is the .lst file from the compile.
(2011-09-11, 21:25:02)KiloBravo Wrote: I set the bootloader pagesize to 8 and said it was 8 pages from the end.
Is that right the code sizw BLPLW was set to 256 ?

0000 00237 org 0x0000
0000 158A 00238 PAGESEL blstart
0001 2F00 00239 goto blstart
00240
00241
00242 ;-------------------------------------
00243 ; GOTO user application
00244 ;-------------------------------------
0EFD 00245 org STARTADDR - 3;space to deposit goto to user application
0EFD 00246 loadusr
0EFD 0000 00247 nop ;page select, replaced by gui
0EFE 0000 00248 nop ;page select, replaced by gui
MPASM 5.42 DS30LOADER.ASM 9-11-2011 14:08:25 PAGE 18

This is the .lst file from the compile.

In my CCS C program I have this .....

#build(reset=0x1, interrupt=0x5) // Necessary for Bootloader
#ORG 0x0EFD,0x0FFF {} // Necessary for Bootloader
If I load the F87 with the bootloader I can talk to the chip thru the DS30 gui. However, it will not load the program as soon as I reset the chip it appears that the boot loader gets trashed.

Initiating write...
Searching for bl . . .
Found PIC16F87 fw ver. 1.0.1
Waiting for bootloader to be ready...ok
Hex file successfully parsed
Writing flash...response timed out
Tx 9 bytes / Rx 4 bytes / 4.3s
Write failed

It's no longer trashing the chip on reset. It just does not write.

Chip Read with BL
:200000008A15002FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FAE

Chip Read after reset with chip trashed.
:20000000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F00

This is from my CCS C code
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 030
0003: NOP

Be a long jump ???

(2011-09-11, 20:38:16)Mikael Gustafsson Wrote: When I download the latest version and assemble there are more than 20 words available. 192 should be enough.


This is what I get when I uncomment that section

MPLINK 4.40, Linker
Device Database Version 1.0
Copyright © 1998-2011 Microchip Technology Inc.
Error - section '.org_3' can not fit the absolute section. Section '.org_3' start=0x00000f40, length=0x00000182
Errors : 1

Link step failed.
----------------------------------------------------------------------
Release build of project `F:\DS30\ds30 Loader\firmware PIC12F PIC16F\ds30Loader.mcp' failed.
Language tool versions: MPASMWIN.exe v5.42, mplink.exe v4.40, mplib.exe v4.40
Sun Sep 11 16:13:01 2011
----------------------------------------------------------------------
BUILD FAILED
Reply
#11
OK, I got it working somewhat.
from the DS30 compile

0000 158A 00237 PAGESEL blstart
0001 2F00 00238 goto blstart
00239
00240
00241 ;------------------------------------------------------------------------------
00242 ; GOTO user application
00243 ;------------------------------------------------------------------------------
0EFD 00244 org STARTADDR - 3 ;space to deposit goto to user application
0EFD 00245 loadusr
0EFD 0000 00246 nop ;page select, replaced by gui
0EFE 0000 00247 nop ;page select, replaced by gui
0EFF 0000 00248 nop ;goto, replaced by gui
00249
00250
00251 ;------------------------------------------------------------------------------
MPASM 5.42 DS30LOADER.ASM 9-12-2011 14:34:26 PAGE 18


LOC OBJECT CODE LINE SOURCE TEXT
VALUE

00252 ; Start of bootloader code
00253 ;------------------------------------------------------------------------------
0F00 00254 org STARTADDR

This is from my CCS C program.
#build(reset=0x0EFC)
which causes this
*
0EFC: MOVLW 00
0EFD: MOVWF 0A
0EFE: GOTO 0C4
0EFF: NOP

Then on the gui I select custom BL 8 pages from then end and 8 pages long

I also checked "Don't write GOTO to the user app"

The BL stays on the chip and will download a small blinky led "hello world" test program. The led flashing works the "hello world" does not. Based on the flashing led rate I think the timing for rs232 is off.

I will keep working on it as time permits.
Reply
#12
from my C compiler forum ?

Can your bootloader correctly handle partial page updates?.
Remember that when programming the program memory, you have to erase an entire 'page' at a time. You haven't said your chip, but unless the page size is one byte. The bootloader will have to erase address 0, to write address 1. Hence it is normal to start the CCS code one page 'up' in memory, or the bootloader needs to understand partial page writes, and read the whole page, and just change the required bytes....

Reply
#13
The boot loader does not handle partial page updates but
it's not a problem because the goto at 0x00 is set by the gui.

If you post the modified MPLAB boot loader project and tell
us the settings you use in the GUI I will take a look at it.
Reply
#14
(2011-09-14, 22:30:16)Mikael Gustafsson Wrote: The boot loader does not handle partial page updates but
it's not a problem because the goto at 0x00 is set by the gui.

If you post the modified MPLAB boot loader project and tell
us the settings you use in the GUI I will take a look at it.

I am a little confused. You want me to compile the DS30 loader in MPLAB and post that code correct ?

Thanks for your help Smile I am a little rusty on PICs and assembler. I usually use the CCS C compiler, but I wanted to start using a Boot Loader. The DS30 seems like a good one.
Reply
#15
This is the .lst file
I tried to attach the .lst file

The type of file that you attached is not allowed. Please remove the attachment or choose a different type.

Do you want the .hex or ds30loader.asm ?
Reply
#16
Zip the MPLAB project and post it.
Reply
#17

.zip   P16F87.zip (Size: 13.35 KB / Downloads: 5) OK, thanks here is the zip. I had to change the size of the BL to 256, not sure why. But if I set osccon for the internal oscillator it won't compile in 192. MPLAB gives an error.

Second, the first four bytes look wrong to me after the user program is loaded

Just the DS30 BL on the chip first page ...
:20000000 8A15002FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FAE
DS30 and user program
:20000000 8A150A12002F00000A108A100A11820720340A340D3453347434613472347434B9
One last thought, since it is greyed out, I assume you do not write the Config words in the free version correct ?

Once again thanks for your help !
Reply
#18
I understand now why I got 23 free instructions, that because I tried on a different PIC16 that has the extended instruction set.

I think you should go back to the 192 boot loader size and the remove the following lines in ds30loader.s:
Code:
        ; Else, unknown command
        ;SendL    UCMD                ;->bank?

The PIC16 family doesn't have the ability to write the configuration words.

What settings do you have in the gui?
The ds30 Loader does handle CCS hex files with movlw and movwf instructions in the beginning.
Reply
#19
OK, I will try that.

In the gui I checked custom boot loader
placement 8 pages from the end
size 8 pages.
I also changed the timeout to 5000 from 3000 ms.
Occasionally it would timeout writing the user program and when it does the bootloader code seems to get overwritten.

Thanks !

I commented the line out in the .s

; Else, unknown command
;SendL UCMD <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
bra main1
I can't use BL size 192 because the source will not compile.
I get this error from MPLAB

MPLINK 4.40, Linker
Device Database Version 1.0
Copyright © 1998-2011 Microchip Technology Inc.
Error - section '.org_3' can not fit the absolute section. Section '.org_3' start=0x00000f40, length=0x00000182
Errors : 1
Link step failed.
----------------------------------------------------------------------
Release build of project `J:\ds30 Loader\firmware PIC12F PIC16F\ds30Loader.mcp' failed.
Language tool versions: MPASMWIN.exe v5.42, mplink.exe v4.40, mplib.exe v4.40
Thu Sep 22 12:02:40 2011
----------------------------------------------------------------------
BUILD FAILED

*************************************************
I commented this out of the .asm file also


; Else, unknown command
;SendL UCMD ;->bank?


Did you mean to comment it out of the .s and the .asm files ? It will now compile in 192 words !!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)