Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pinguino for pic32mz1024ECH064?
01-10-2015, 05:06 PM,
#11
RE: Pinguino for pic32mz1024ECH064?
Obviously, escape sequences like \033[32;1m are not supported. You can remove them or replace them if there is any equivalent.

About the address issue, you know that PIC32 have physical but also virtual memory.
For instance, a line like :020000049D005D means the compiler will write the following data at the given memory position (0x9D000000).
02 : number of bytes to write
0000 : 16-bit address of the beginning of the memory position for the data
04 : record type, here "Extended Linear Address Record"
9D00 : so address is 0x9D000000
5D : checksum

According to the linker script 0x9D000000 is where we put the beginning of kseg0_program_mem (where the program's code starts). This is a virtual address but the hex file must contains only physical address. That's why sed replace it by its physical equivalent : 0x1D000000 (:020000041D00DD).

In order to add the PIC32mz1024ECH064 support you need :
- to add a linker script : lkr/32mz1024ECH064.ld (the other one is no longer used with new chips)
- to add a header file : proc/p32mz1024ECH064.h (get it from Microchip)
- to add an object file : obj/non-free/32MZ1024ECH064.o (get it from Microchip)
- to add config bits in config.h (use #if defined(__32MZ1024ECH064__) ... #endif)
- to add led and button pins definitions in hardware.h (use #if defined(__32MZ1024ECH064__) ... #endif)
- to change the USB_MINOR_VER to 4 in boot.h
- to add a short description what you did with v1.4 in boot.h
- to check all other .c and .h source files to be sure your PIC is supported, for each exception add a #if defined(__32MZ1024ECH064__) ... #endif
- to take special care to all assembly routines
The compilation errors will give you other ideas about what to do ;-)

elf32pic32mx.x is the file where memory sections are described. In my opinion you won't have to modify that one. However, I might be wrong.

Good luck.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
01-10-2015, 09:00 PM,
#12
RE: Pinguino for pic32mz1024ECH064?
Thank you for the explanation, I will try, but it is looking kinda complicated and I dont know many things, for instance:
Code:
kseg0_boot_mem             : ORIGIN = 0x9FC004B0, LENGTH = 0x0
how can boot segment 0 memory size be 0x0? See: https://github.com/jasonkajita/pic32-par...4ECH064.ld
Reply
02-10-2015, 05:43 PM,
#13
RE: Pinguino for pic32mz1024ECH064?
First of all, you need to know there are memory areas, physical or virtual, cacheable or non-cacheable and there are sections. Virtual addresses are exclusively used by the CPU.
So you have a boot memory area (see datasheet, chap. 4 - memory organization) but you also have a boot memory section.
Most of the time this boot section is placed in the boot mem area but it is not mandatory. On the new USB bootloader (the one you try to compile) I placed the boot mem section (kseg0_boot_mem) in another memory area. There is a reason why I did it but I will explain later.

Second, despite its name, this kseg0_boot_mem section has nothing to do with any bootloader, it is intended to contain C startup module. However we could put a bootloader there after the C startup but the problem is the boot mem is only 0xBEF bytes on PIC32MX2xx.

Third, I guess you choose the wrong file to start because you shouldn't have :
kseg0_boot_mem : ORIGIN = 0x9FC004B0, LENGTH = 0x0
but
kseg0_boot_mem : ORIGIN = 0x9FC00010, LENGTH = 0x200
as the startup sequence is about 0x180 bytes long and starts right after the jump to the reset vector (10 bytes long) which is always virtually at 0xBFC00000 (KSEG1) or 0x9FC00000 (KSEG0) or physically at 0x1FC00000.

It took me some time to get it but if you look at the memory map and read some explanations I put in the linker scripts (take a look at lkr/32MX270F256B.ld) you should understand.

Finally, if you take a look at the datasheet of your PIC32MZ, you'll find equivalent to the PIC32MX memory map. You only have 4 KSEG instead of 2. The boot flash area seems to be large enough (0xFF40) to put the bootloader in it.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
02-10-2015, 07:02 PM,
#14
RE: Pinguino for pic32mz1024ECH064?
Thank you, I will surely consider your hints.

I'm trying to use both datasheets and other code files, and that "LENGTH = 0x0" was based on this: https://github.com/jasonkajita/pic32-par...4ECH064.ld

I am also reading the ChipKit PIC32MZ bootloader code: https://github.com/chipKIT32/PIC32-avrdu...rscript.ld
They have made a PIC32MZ2048ECG board called "Wi-FIRE" and it might be also a helpful reference, atought that's a different chip.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)