Skip to content

Commit

Permalink
Olimex PIC32-EMZ64 board support
Browse files Browse the repository at this point in the history
https://www.olimex.com/Products/PIC/Development/PIC32-EMZ64/
https://github.com/sergev/LiteBSD/wiki/Olimex%20EMZ64%20board

Most interesting about this board - it is pretty cheap,
it has CAN connector and small OLED display (SSD1306) 128x64 dots.

Signed-off-by: Leonid Yegoshin <[email protected]>
  • Loading branch information
Leonid Yegoshin authored and Leonid Yegoshin committed Jun 16, 2017
1 parent 1e759b5 commit ef933da
Show file tree
Hide file tree
Showing 10 changed files with 2,328 additions and 0 deletions.
12 changes: 12 additions & 0 deletions boards/OlimexPic32EMZ64
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PLATFORM = pic32mz2048efg100
BOOT = boot.S
rom = 0x1d010000 0x1D200000
ram = 0 0x78000
eret_page = 0x9ffff000
vzcode = 0x9FC00000
vzentry = 0x9FC00000
vzdata = 0x80078000
vzstacktop = 0x80080000
DEVCFG = boards/OlimexPic32EMZ64-DEVCFG.S
DEVCFGADDR = 0x9FC0FFC0
BOARDINIT = boards/OlimexPic32EMZ64-init.S
5 changes: 5 additions & 0 deletions boards/OlimexPic32EMZ64-DEVCFG.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.section .sdata
.word 0xCEFFFFFF // DEVCFG3
.word 0xFFF9B12A // DEVCFG2
.word 0x5F74FE39 // DEVCFG1
.word 0xFFFFF7D3 // DEVCFG0
75 changes: 75 additions & 0 deletions boards/OlimexPic32EMZ64-init.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.section .text.init, "ax"
.type _board_init, @function
.globl _board_init

_board_init:
li $2, 7 << 8
sw $2, 0xbf860134 // LATBCLR
sw $2, 0xbf860114 // TRISBCLR
li $2, 1 << 9 // yellow LED2=RB9
la $3, 0xbf860138
sw $2, 0($3) // LATBSET
// setup a console routing for 64pin SoC
li $2, 3
sw $2, 0xBF801480 // U4RXR = RD0
li $2, 2
sw $2, 0xBF8015D0 // RPD4R = U4TX
jr $31
nop

.type _board_init_end, @function
.globl _board_init_end

_board_init_end:
li $2, 7 << 8
sw $2, 0xbf860134 // LATBCLR
li $2, 1 << 8 // green LED2=RB8 only
la $3, 0xbf860138
sw $2, 0($3) // LATBSET
jr $31
nop

.type _nmi_exception, @function
.globl _nmi_exception
_nmi_exception:
// LED1-3
li $2, 7 << 8
sw $2, 0xbf860134 // LATBCLR
sw $2, 0xbf860114 // TRISBCLR
// Light RGB
li $2, 7 << 8
sw $2, 0xbf860138 // LATBSET red+yellow+green
1: b 1b
nop

.type _bev_exception, @function
.globl _bev_exception
_bev_exception:
// LED1-3
li $2, 7 << 8
sw $2, 0xbf860134 // LATBCLR
sw $2, 0xbf860114 // TRISBCLR
// Light RGB
li $2, 1 << 10
sw $2, 0xbf860138 // LATBSET red only
1: b 1b
nop

.section .rodata
// UART4 as a console
.type console_uart, @object
.globl console_uart
console_uart:
.word 0xbf822600
.type console_paddr, @object
.globl console_paddr
console_paddr:
.word 0x1f822600
.type console_irq_rx, @object
.globl console_irq_rx
console_irq_rx:
.short 171
.type console_irq_tx, @object
.globl console_irq_tx
console_irq_tx:
.short 172
14 changes: 14 additions & 0 deletions config-OlimexPic32EMZ64.file
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.vm
id = 1
irqpolling = 1
elf = pic32mz-Olimex/uart.elf
.mmap
code = 0x1fc08000 0x8000 rxds 0x1fc08000
ram = 0 0x10000 rw 0x1000
.
device = ic
device = console
device = ports
device = syscontroller
device = oscillator
.
22 changes: 22 additions & 0 deletions pic32mz-Olimex/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
P = mips-mti-linux-gnu-
#P = /usr/local/mips-2014.11/bin/mips-sde-elf-
CC = $(P)gcc -mips32r2 -EL -g -nostdlib
OBJCOPY = $(P)objcopy
OBJDUMP = $(P)objdump
CFLAGS = -O -Wall -Werror -DPIC32MZ
LDFLAGS = -T pic32mz.ld -e _start

PROG = uart

all: $(PROG).hex # $(PROG).srec

$(PROG).hex: $(PROG).c
$(CC) $(CFLAGS) -c $<
$(CC) $(LDFLAGS) $(PROG).o $(LIBS) -o $(PROG).elf
# $(OBJCOPY) -O ihex --change-addresses -0x2BE0000 $(PROG).elf $(PROG).hex
$(OBJDUMP) -mmips:isa32r2 -d -S $(PROG).elf > $(PROG).dis

$(PROG).srec:
mips-mti-linux-gnu-objcopy -O srec uart.hex uart.srec
clean:
rm -f *.o *.lst *~ *.elf *.hex *.dis *.srec
2 changes: 2 additions & 0 deletions pic32mz-Olimex/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Example of simple program for Microchip Explorer 16 board
with PIC32MZ plug-in module.
Loading

0 comments on commit ef933da

Please sign in to comment.