PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

panjeta
Posts: 3
Joined: Wed Nov 04, 2015 2:07 pm

PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by panjeta » Wed Nov 04, 2015 2:20 pm

Hi Everyone,

I want to use mplab x to program uc32 instead of mpide. I followed the tutorial, @ http://chipkit.net/programming-chipkit- ... in-mplabx/ but had no luck . Do I have to select memory address too like starting address and end address. As, it gives me error that address is out of range while trying to write hex file.

Thanks,

l.varani
Posts: 5
Joined: Mon Nov 09, 2015 6:35 am

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by l.varani » Tue Nov 10, 2015 9:14 pm

I think you have the same problem I have:
the hex file generated contain four lines like:
.............................
:020000041FC01B
:1004800000F89B40C0000000009D1B3C64177B27C8
:10049000020060130000000000C09B4000F81B40F9
:0C04A000C00000001F000042000000002F
.............................

How I solved the problem?
First :
I check the option 'normalize hex file' in the window properties->building of the project in MPLAB-X
In this way the four lines you see are the last lines of the file and in this way is more simple to find them.
Second:
ELIMINATING the four lines.
I try in a first time manualy via a text editor and then I call the AVRDUDE thru a bat file.
In a second time I generate a .exe file that delete the four line . I use then a .bat file that first call the 'remover' an then call AVRDUDE,
I call then the .bat thru the MPLAB X line, in the properties->building window in the line "execute this line after build".

I'm foul? Maybe.. but seem everything go better.
The question is related to the use of the region of memory specified by the tree lines .
I thing the memory region involved (0X1FC00480) is used for debugging (you do analize the default linker script file and the two linker script files and study the memory usage of the micro).
In this moment I don't use a debugger...
saluti ! and excuse my english...
luciano

panjeta
Posts: 3
Joined: Wed Nov 04, 2015 2:07 pm

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by panjeta » Wed Nov 11, 2015 1:51 pm

Thanks a lot Luciano, it worked . I was able to program uc32 with mplab x. I really appreciated this.

Sent from my SM-G920W8 using Tapatalk

l.varani
Posts: 5
Joined: Mon Nov 09, 2015 6:35 am

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by l.varani » Wed Nov 11, 2015 7:31 pm

Di niente!

But a duobt remain
the four lines I delete

:020000041FC01B
:1004800000F89B40C0000000009D1B3C64177B27C8
:10049000020060130000000000C09B4000F81B40F9
:0C04A000C00000001F000042000000002F

What exactly do? (it's very difficult for me interpeter them thru the . hex code)
There is somone who can help me?

The question is not very simple I think...
I note tha the California University, suggest to CHANGE the bootloader.. (read here)

https://classes.soe.ucsc.edu/cmpe118/Fa ... tation.pdf
https://classes.soe.ucsc.edu/cmpe118/Wi ... ctions.pdf

In this case you do reprogram the board.
But many students don't have a programmer.... (I'm an old teacher...)

Luciano

GrahamM242
Posts: 65
Joined: Fri Feb 21, 2014 6:48 pm

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by GrahamM242 » Thu Nov 12, 2015 3:41 pm

Been a while since I tried to take intel hex apart... The lines basically write 0x2C bytes to 0x1FC00480. The bytes written are:

Code: Select all

00F89B40C0000000009D1B3C64177B27020060130000000000C09B4000F81B40C00000001F00004200000000
The block of memory is within the internal boot flash of the device as far as I can see. Making an assumption or two (as I'm not that familiar with MIPS), the asm code would be something like:

Code: Select all

1FC00480                 mtc0    $k1, $31   		 ; k1 to cp0 reg 31 - EJTAG debug exception save register
1FC00484                 ehb		    				 ; Execution hazard barrier
1FC00488                 li      $k1, 0x9D001764   ; 0x9D001764 to k1
1FC00490                 beqz    $k1, loc_1FC0049C ; branch to loc_1FC0049C if k1 = 0
1FC00494                 nop
1FC00498                 mtc0    $k1, $24   		 ; k1 to cp0 reg 24 - Program counter at last EJTAG debug exception
1FC0049C
1FC0049C loc_1FC0049C:
1FC0049C                 mfc0    $k1, $31		 	; k1 to cp0 reg 31 - EJTAG debug exception save register
1FC004A0                 ehb		    		 		; Execution hazard barrier
1FC004A4                 deret						   ; Debug exception return
Alas, I can't tell you what that's good for.

l.varani
Posts: 5
Joined: Mon Nov 09, 2015 6:35 am

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by l.varani » Thu Nov 12, 2015 9:42 pm

many many thanks!!
Now I have material....
The ideas are two: work inside MPLAB-X script link files and modify them in mode that the area was left free.
I think there are problems.
The file p32MX340F128H.ld (2015) from Microchip specify:
.................................
/*************************************************************************
* Memory Regions
*
* Memory regions without attributes cannot be used for orphaned sections.
* Only sections specifically assigned to these regions can be allocated
* into these regions.
*
* The Debug exception vector is located at 0x9FC00480. <<<<<<< read this
*
* The config_<address> sections are used to locate the config words at
* their absolute addresses.
*************************************************************************/
MEMORY
{
kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x20000
kseg0_boot_mem : ORIGIN = 0x9FC00490, LENGTH = 0x970
exception_mem : ORIGIN = 0x9FC01000, LENGTH = 0x1000
kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0x490
debug_exec_mem : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
config3 : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
config2 : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
config1 : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
config0 : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x8000
sfrs : ORIGIN = 0xBF800000, LENGTH = 0x100000
configsfrs : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
}

*************************************************************************/
..................................

a second idea is to bypass the location 0x1FC00490 ( incompatible with avrdude),rewriting some location near 0x1FC00480 with a Jmp to another line (after 0x1FC004A0 ?? ) where recopy the code ; working 'hard' on the .hex file.
but tonight I'm so tired, .....
luciano

GrahamM242
Posts: 65
Joined: Fri Feb 21, 2014 6:48 pm

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by GrahamM242 » Fri Nov 13, 2015 10:44 am

Don't forget that the PIC32 has physical and virtual memory maps that are different. At this point, I am beyond my knowledge of how things fit together in the world of PIC32.

panjeta
Posts: 3
Joined: Wed Nov 04, 2015 2:07 pm

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by panjeta » Thu Dec 31, 2015 4:49 pm

Hello Luciano,

Sorry for really late solution. May be you have already found a solution. Anyways, to program with MPLAB X we need to add few line in the chipKIT-application-COMMON.ld linker script. lines are:

SECTION
{
/DISCARD/ : { *(._debug_exception) }
}

for more info see http://microchip.wikidot.com/faq:79

doing this will omit those lines in the hex file that we were manually deleting. This is some issue with xc32 compiler.

hopefully this might help.

Thanks
panjeta

l.varani
Posts: 5
Joined: Mon Nov 09, 2015 6:35 am

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by l.varani » Tue Feb 09, 2016 7:58 pm

Many thanks!!
I'm doing some test.....
but without a 'brute' line remover, the answer is:

avrdude.exe: ERROR: address 0x1fc00490 out of range at line 179 of dist\default\production\LedAcceso.X.production.hex
avrdude.exe: write to file 'dist\default\production\LedAcceso.X.production.hex' failed
avrdude.exe done. Thank you.
make[1]: *** [.build-conf] Error 1
make: *** [.build-impl] Error 2
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/temp/SEI_16/PROG_01/LedAcceso.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 8s)


with the brute remover (named VaroConvert.exe) the answer is:

"User defined post-build step: [\AvrDude\upload.bat COM9 "dist\default\production\LedAcceso.X.production.hex"]"
C:\temp\SEI_16\PROG_01\LedAcceso.X>"\AvrDude\VaroConvert.exe" dist\default\production\LedAcceso.X.production.hex

C:\temp\SEI_16\PROG_01\LedAcceso.X>"\AvrDude\avrdude.exe" -C "\AvrDude\avrdude.conf" -v -p32MX320F128H -cstk500v2 -P COM9 -b 115200 -U flash:w:dist\default\production\LedAcceso.X.production.hex

avrdude.exe: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "\AvrDude\avrdude.conf"

Using Port : COM9
Using Programmer : stk500v2
......
.....

and so on.
And the led is flashing......
Only remain to read the Microchip document yu suggest
Luciano

P.S.
Iam using a ChipKit UNO32, not an UC32...
But all the experiments I've done go well, not only flashing a led. The question now is:

svs_03
Posts: 2
Joined: Tue May 31, 2016 11:51 am

Re: PROGRAMMING uC32 USING MPLAB X WITHOUT PICKIT

Post by svs_03 » Tue May 31, 2016 4:48 pm

i used same procedure i am getting fallowing errors

plesae help

Post Reply