MIPS32 port

ChibiOS public support forum for topics related to the micro-controllers based on MIPS32 cores.
pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: MIPS32 port

Postby pito » Sat Jan 12, 2013 11:40 am

Hi Dmytro,
we are using this compiler (under linux) with retrobsd (http://retrobsd.org/wiki/doku.php):
https://github.com/jasonkajita/chipKIT-cxx/downloads
It supports mips16 as well. Would it build with your pic32 chibios port?
P.

Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: MIPS32 port

Postby Dmytro » Sun Jan 13, 2013 12:42 pm

Hi Pito,
it seems like I have same issues with your compiler as with one from microchip. Moreover I have a feeling that it is microchip's compiler with some modification.
I'll check retrobsd's code to get some glue.

Thanks

Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: MIPS32 port

Postby Dmytro » Sun Jan 13, 2013 7:30 pm

Pito, my mistake... With your toolchain I can successfully run pic32 port. I forgot to rallback few changes I did while investigating the issues with xc32.
However your compiler doesn't know JALX instruction(jump and change mode to mips16). After converting it into jalr I can build for mips16 and pass the tests w/o any issue:
Final result: SUCCESS
ch> info
Kernel: 2.5.2unstable
Compiler: GCC 4.5.1 chipKIT Compiler for PIC32 MCUs v1.31-20120614
Architecture: MIPS32
Core Variant: MIPS32r2
Port Info: Pure MIPS mode
Platform: MIPS-PIC32MX
Build time: Jan 13 2013 - 19:27:21

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: MIPS32 port

Postby pito » Tue Jan 15, 2013 12:04 pm

Dmytro, I may try with the Fubarino board. Is there an installation/configuration guide available?
P.

Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: MIPS32 port

Postby Dmytro » Tue Jan 15, 2013 5:42 pm

Pito, thanks for trying. You can find a small HOWTO inside demos/MIPS-PIC32MX795F512L-PIC32-MAXI-WEB

cheers,
-- dmytro

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: MIPS32 port

Postby pito » Tue Jan 15, 2013 6:53 pm

When git cloning from your repo at https://github.com/niamster/ChibiOS/tree/mips-pic32mx ( https://github.com/niamster/ChibiOS.git ) I do not get "MIPS" related demos.. as well as boards, platforms, port, rules related to MIPS.. What repo shall I clone actually?
PS: I downloaded the zip with ChibiOS-mips-pic32mx, it compiles, error with linker:

Code: Select all

 Linking build/ch.elf
/usr/local/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld:ld/mips_pic32mx795f512l.lds:115: warning: memory region `kseg0_boot_mem' not declared
/usr/local/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld: Warning: kseg0_boot_mem memory region not defined, using default range: 0x9fc00490 .. 0x9fc00dff
/usr/local/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld:ld/mips_pic32mx795f512l.lds:115: warning: memory region `exception_mem' not declared
/usr/local/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld: Warning: exception_mem memory region not defined, using default range: 0x9fc01000 .. 0x9fc01fff
/usr/local/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld:ld/mips_pic32mx795f512l.lds:115: warning: memory region `kseg1_data_mem' not declared
/usr/local/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld: Warning: kseg1_data_mem memory region not defined, using default range: 0xa0000000 .. 0xa0007fff
build/obj/shell.o: In function `_strtok':
/home/pito/chibios/ChibiOS-mips-pic32mx/demos/MIPS-PIC32MX795F512L-PIC32-MAXI-WEB/../../os/various/shell.c:51: undefined reference to `strpbrk'
collect2: ld returned 1 exit status
make: *** [build/ch.elf] Error 1

The only change I did in the Makefile:

Code: Select all

#TRGT  ?= mips-sde-elf-
TRGT  ?= /usr/local/pic32-tools/bin/pic32-

Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: MIPS32 port

Postby Dmytro » Tue Jan 15, 2013 9:59 pm

Pito, when you clone the repo by default you have master branch. So you have to checkout mips-pic32mx remote branch after.
If you want to use your compiler you need to use xc32-ish ld script + few stubs. I just pushed my work related to xc32, please pull the changes(or redownload the archive).

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: MIPS32 port

Postby pito » Wed Jan 16, 2013 11:01 am

Hi Dmytro, thanks!

Code: Select all

..
Compiling ../../boards/MIPS-PIC32MX795F512L-PIC32-MAXI-WEB/board.c
Compiling ../../os/various/shell.c
Compiling ../../os/various/chprintf.c
Compiling stubs.c
Compiling main.c
Linking build/ch.elf
Linking build/ch.elf.strip
Creating build/ch.dmp
Done
pito@ubuntu:~/chibios/ChibiOS-mips-pic32mx/demos/MIPS-PIC32MX795F512L-PIC32-MAXI-WEB/build$ ls -l
total 1020
-rw-r--r-- 1 pito root 166778 2013-01-16 10:53 ch.dmp
-rwxr-xr-x 1 pito root 505779 2013-01-16 10:53 ch.elf
-rwxr-xr-x 1 pito root 209604 2013-01-16 10:53 ch.elf.strip
-rw-r--r-- 1 pito root 406430 2013-01-16 10:53 ch.map
drwxr-xr-x 2 pito root   4096 2013-01-16 10:53 lst
drwxr-xr-x 2 pito root   4096 2013-01-16 10:53 obj

PS: a .hex to have at the end would be fine (objcopy -O ihex ch.elf ch.hex), I may flash it with ie. (using the usbboot-loader) http://code.google.com/p/pic32prog/wiki/README then ;)
PS0: trying to flash to the fubarino board ( http://www.seeedstudio.com/wiki/Fubarino_SD w/ 795F512H chip ) - UART1 @115k2
PS1: trying to flash it with pickit2 tool (win) - warning: no config words in hex file.., no luck
PS2: uploaded it with pic32prog (usbboot-loader, lin) - no luck
PS3: flashed with pic32prog and pickit2 (lin), no luck yet..
PS4: MPLABX supports pickit3 only, so flashing outside mplabx would be nice to have (for pickit2 users)..
p.

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: MIPS32 port

Postby pito » Wed Jan 16, 2013 9:04 pm

I used mplab ide 8.86 to convert elf to hex - imported ch.elf and exported ch.hex (with config bits), then flashed with pickit2. It seems that works.. Would be better to do it with objcopy somehow.. (thanks Jaromir for the hint).

Code: Select all

ch> test

*** ChibiOS/RT test suite
***
*** Kernel:       2.5.2unstable
*** Compiled:     Jan 16 2013 - 12:07:34
*** Compiler:     GCC 4.5.1 chipKIT Compiler for PIC32 MCUs v1.30-20110506
*** Architecture: MIPS32
*** Core Variant: MIPS32r2
*** Port Info:    Pure MIPS mode
*** Platform:     MIPS-PIC32MX

----------------------------------------------------------------------------
--- Test Case 1.1 (Threads, enqueuing test #1)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.2 (Threads, enqueuing test #2)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.3 (Threads, priority change)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.4 (Threads, delays)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.1 (Semaphores, enqueuing)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.2 (Semaphores, timeout)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.3 (Semaphores, atomic signal-wait)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.4 (Binary Semaphores, functionality)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.1 (Mutexes, priority enqueuing test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.2 (Mutexes, priority inheritance, simple case)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.3 (Mutexes, priority inheritance, complex case)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.4 (Mutexes, priority return)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.5 (Mutexes, status)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.6 (CondVar, signal test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.7 (CondVar, broadcast test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.8 (CondVar, boost test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.1 (Messages, loop)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 5.1 (Mailboxes, queuing and timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.1 (Events, registration and dispatch)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.2 (Events, wait and broadcast)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.3 (Events, timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 7.1 (Heap, allocation and fragmentation test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 8.1 (Memory Pools, queue/dequeue)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.1 (Dynamic APIs, threads creation from heap)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.2 (Dynamic APIs, threads creation from memory pool)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.3 (Dynamic APIs, registry and references)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.1 (Queues, input queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.2 (Queues, output queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.1 (Benchmark, messages #1)
--- Score : 209998 msgs/S, 419996 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.2 (Benchmark, messages #2)
--- Score : 177248 msgs/S, 354496 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.3 (Benchmark, messages #3)
--- Score : 177248 msgs/S, 354496 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.4 (Benchmark, context switch)
--- Score : 583992 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.5 (Benchmark, threads, full cycle)
--- Score : 35999 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.6 (Benchmark, threads, create only)
--- Score : 38666 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.7 (Benchmark, mass reschedule, 5 threads)
--- Score : 59000 reschedules/S, 354000 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.8 (Benchmark, round robin context switching)
--- Score : 410960 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.9 (Benchmark, I/O Queues throughput)
--- Score : 1083996 bytes/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.10 (Benchmark, virtual timers set/reset)
--- Score : 752818 timers/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.11 (Benchmark, semaphores wait/signal)
--- Score : 872996 wait+signal/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.12 (Benchmark, mutexes lock/unlock)
--- Score : 936996 lock+unlock/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.13 (Benchmark, RAM footprint)
--- System: 620 bytes
--- Thread: 76 bytes
--- Timer : 20 bytes
--- Semaph: 12 bytes
--- EventS: 4 bytes
--- EventL: 16 bytes
--- Mutex : 16 bytes
--- CondV.: 8 bytes
--- Queue : 36 bytes
--- MailB.: 40 bytes
--- Result: SUCCESS
----------------------------------------------------------------------------

Final result: SUCCESS

Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: MIPS32 port

Postby Dmytro » Wed Jan 16, 2013 10:38 pm

Thanks for the feedback, Pito.
I'll commit the changes to generate HEX soon.


Return to “MIPS32 Support”

Who is online

Users browsing this forum: No registered users and 6 guests