Skip to content

Commit 6847600

Browse files
committed
Merge pull request #2 from gera-k/mips-pic32mx
Mips pic32mx
2 parents 10dd08a + 6673716 commit 6847600

File tree

24 files changed

+6408
-10
lines changed

24 files changed

+6408
-10
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#include "ch.h"
18+
#include "hal.h"
19+
20+
PIC32MX_DEVCFG0(
21+
DEVCFG0_ICESEL_CH2 // Use PGC2/PGD2
22+
| DEVCFG0_DEBUG_DISABLED // Disable DEBUG
23+
);
24+
PIC32MX_DEVCFG1(
25+
DEVCFG1_FNOSC_PRIPLL // Primary oscillator with PLL
26+
| DEVCFG1_IESO // Internal-external switch over
27+
| DEVCFG1_POSCMOD_HS // HS oscillator
28+
| DEVCFG1_FPBDIV_1 // SYSCLK / 1
29+
);
30+
PIC32MX_DEVCFG2(
31+
DEVCFG2_FPLLIDIV_2 // PLL Input Divider
32+
| DEVCFG2_FPLLODIV_1 // PLL Output Divider
33+
| DEVCFG2_FPLLMUL_20 // PLL Multiplier
34+
| DEVCFG2_FUPLLEN // USB PLL Enabled
35+
| DEVCFG2_UPLLIDIV_2 // USB PLL Input Divider
36+
);
37+
PIC32MX_DEVCFG3( PIC32MX_DEVCFG3_UID(0xBEBE) // User ID ;)
38+
// | DEVCFG3_FUSBIDIO
39+
// | DEVCFG3_FVBUSONIO
40+
// | DEVCFG3_FCANIO
41+
| DEVCFG3_FMIIEN // Enable RMII
42+
| DEVCFG3_FETHIO // Alternate ethernet pins
43+
// | DEVCFG3_FSRSSEL_7
44+
);
45+
46+
/*
47+
* Board-specific initialization code.
48+
*/
49+
void boardInit(void) {
50+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#ifndef _BOARD_H_
18+
#define _BOARD_H_
19+
20+
#if !defined(_FROM_ASM_)
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
void boardInit(void);
25+
#ifdef __cplusplus
26+
}
27+
#endif
28+
#endif /* _FROM_ASM_ */
29+
30+
#endif /* _BOARD_H_ */
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# List of all the board related files.
2+
BOARDSRC = ${CHIBIOS}/boards/MIPS-PIC32MX795F512L-PIC32-ESK/board.c
3+
4+
# Required include directories
5+
BOARDINC = ${CHIBIOS}/boards/MIPS-PIC32MX795F512L-PIC32-ESK
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?fileVersion 4.0.0?>
3+
4+
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
5+
<storageModule moduleId="org.eclipse.cdt.core.settings">
6+
<cconfiguration id="cdt.managedbuild.toolchain.gnu.cross.base.1909804850">
7+
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.1909804850" moduleId="org.eclipse.cdt.core.settings" name="Default">
8+
<macros>
9+
<stringMacro name="__DOXYGEN__" type="VALUE_TEXT" value="1"/>
10+
</macros>
11+
<externalSettings/>
12+
<extensions>
13+
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
14+
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
15+
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
16+
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
17+
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
18+
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
19+
</extensions>
20+
</storageModule>
21+
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
22+
<configuration artifactName="ChibiOs-PIC32ESK" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.cross.base.1909804850" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
23+
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.1909804850.1322262094" name="/" resourcePath="">
24+
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.1177879343" name="cdt.managedbuild.toolchain.gnu.cross.base" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
25+
<option id="cdt.managedbuild.option.gnu.cross.prefix.287782295" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
26+
<option id="cdt.managedbuild.option.gnu.cross.path.1103805465" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
27+
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.375587034" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
28+
<builder buildPath="C:\W\Chibios\trunk\demos\MIPS-PIC32MX795F512L-PIC32-ESK" id="cdt.managedbuild.builder.gnu.cross.416078451" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
29+
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.355589899" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
30+
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1999092538" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
31+
</tool>
32+
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.226208331" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
33+
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1706922271" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
34+
</tool>
35+
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.458415314" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
36+
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1913636543" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
37+
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1875079109" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
38+
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
39+
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
40+
</inputType>
41+
</tool>
42+
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1967671846" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
43+
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.670803072" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
44+
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.621706684" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
45+
</tool>
46+
</toolChain>
47+
</folderInfo>
48+
</configuration>
49+
</storageModule>
50+
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
51+
</cconfiguration>
52+
</storageModule>
53+
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
54+
<project id="ChibiOs-PIC32ESK.null.142574692" name="ChibiOs-PIC32ESK"/>
55+
</storageModule>
56+
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
57+
<storageModule moduleId="refreshScope" versionNumber="2">
58+
<configuration configurationName="Default">
59+
<resource resourceType="PROJECT" workspacePath="/ChibiOs-PIC32ESK"/>
60+
</configuration>
61+
</storageModule>
62+
<storageModule moduleId="scannerConfiguration">
63+
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
64+
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.1909804850;cdt.managedbuild.toolchain.gnu.cross.base.1909804850.1322262094;cdt.managedbuild.tool.gnu.cross.cpp.compiler.226208331;cdt.managedbuild.tool.gnu.cpp.compiler.input.1706922271">
65+
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
66+
</scannerConfigBuildInfo>
67+
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.1909804850;cdt.managedbuild.toolchain.gnu.cross.base.1909804850.1322262094;cdt.managedbuild.tool.gnu.cross.c.compiler.355589899;cdt.managedbuild.tool.gnu.c.compiler.input.1999092538">
68+
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
69+
</scannerConfigBuildInfo>
70+
</storageModule>
71+
</cproject>
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
##############################################################################
2+
# Build global options
3+
# NOTE: Can be overridden externally.
4+
#
5+
6+
#USE_VERBOSE_COMPILE = yes
7+
8+
# Compiler options here.
9+
ifeq ($(USE_OPT),)
10+
USE_OPT = -EL -O2 -ggdb -ffreestanding
11+
USE_OPT += -mtune=4kc
12+
# usually gives very good i-cache hit rate
13+
USE_OPT += -falign-functions=16
14+
USE_OPT += -D__32MX795F512L__
15+
USE_OPT += -DCHPRINTF_CR_INSERT=TRUE
16+
USE_OPT += -DCHPRINTF_USE_FLOAT=TRUE
17+
endif
18+
19+
# C specific options here (added to USE_OPT).
20+
ifeq ($(USE_COPT),)
21+
USE_COPT =
22+
endif
23+
24+
# LD specific options here (added to USE_OPT).
25+
ifeq ($(USE_LDOPT),)
26+
USE_LDOPT = -EL -lc
27+
endif
28+
29+
# C++ specific options here (added to USE_OPT).
30+
ifeq ($(USE_CPPOPT),)
31+
USE_CPPOPT = -fno-rtti -fno-exceptions
32+
endif
33+
34+
# Enable this if you want to compile in mips16 ISA
35+
ifeq ($(USE_MIPS16),)
36+
USE_MIPS16 = no
37+
endif
38+
39+
# Enable this if you want the linker to remove unused code and data
40+
ifeq ($(USE_LINK_GC),)
41+
USE_LINK_GC = yes
42+
endif
43+
44+
# Enable this if you want to see the full log while compiling.
45+
ifeq ($(USE_VERBOSE_COMPILE),)
46+
USE_VERBOSE_COMPILE = no
47+
endif
48+
49+
#
50+
# Build global options
51+
##############################################################################
52+
53+
##############################################################################
54+
# Project, sources and paths
55+
#
56+
57+
# Define project name here
58+
PROJECT = ch
59+
60+
# Imported source files and paths
61+
CHIBIOS = ../..
62+
include $(CHIBIOS)/boards/MIPS-PIC32MX795F512L-PIC32-ESK/board.mk
63+
include $(CHIBIOS)/os/hal/platforms/MIPS-PIC32MX/platform.mk
64+
include $(CHIBIOS)/os/hal/hal.mk
65+
include $(CHIBIOS)/os/ports/GCC/MIPS/MIPS32r2/port.mk
66+
include $(CHIBIOS)/os/kernel/kernel.mk
67+
include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk
68+
include $(CHIBIOS)/test/test.mk
69+
70+
# Define linker script file here
71+
LDSCRIPT= ld/mips_pic32mx795f512l.lds
72+
73+
# List C source files here
74+
CSRC = $(PORTSRC) \
75+
$(KERNSRC) \
76+
$(TESTSRC) \
77+
$(HALSRC) \
78+
$(PLATFORMSRC) \
79+
$(BOARDSRC) \
80+
$(LWSRC) \
81+
$(CHIBIOS)/os/various/shell.c \
82+
$(CHIBIOS)/os/various/chprintf.c \
83+
$(CHIBIOS)/os/various/evtimer.c \
84+
$(CHIBIOS)/os/various/memstreams.c \
85+
usbcfg.c \
86+
stubs.c \
87+
./web/web.c \
88+
main.c
89+
90+
# List C++ source files here
91+
CPPSRC =
92+
# List ASM source files here
93+
ASMSRC = $(PORTASM) $(PLATFORMASM)
94+
95+
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(TESTDMAINC) \
96+
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(LWINC) \
97+
$(CHIBIOS)/os/various
98+
99+
#
100+
# Project, sources and paths
101+
##############################################################################
102+
103+
##############################################################################
104+
# Compiler settings
105+
#
106+
107+
MCU =
108+
109+
#TRGT ?= mips-sde-elf-
110+
#TRGT ?= /usr/local/mips-2012.03/bin/mips-sde-elf-
111+
TRGT ?= /usr/local/mips-gcc-4.7.2/bin/mips-elf-
112+
113+
CC = $(TRGT)gcc
114+
CPPC = $(TRGT)g++
115+
# Enable loading with g++ only if you need C++ runtime support.
116+
# NOTE: You can use C++ even without C++ support if you are careful. C++
117+
# runtime support makes code size explode.
118+
LD = $(TRGT)gcc
119+
#LD = $(TRGT)g++
120+
CP = $(TRGT)objcopy
121+
AS = $(TRGT)gcc -x assembler-with-cpp
122+
OD = $(TRGT)objdump
123+
STRIP= $(TRGT)strip --strip-all
124+
SREC = $(CP) -O srec
125+
HEX = $(CP) -O ihex --change-addresses=0x80000000 --change-section-address .boot=0x1FC00000 --change-section-address .devcfg=0x1FC02FF0
126+
127+
# Define C warning options here
128+
CWARN = -Wall -Wextra -Wstrict-prototypes
129+
130+
# Define C++ warning options here
131+
CPPWARN = -Wall -Wextra
132+
133+
#
134+
# Compiler settings
135+
##############################################################################
136+
137+
##############################################################################
138+
# Start of default section
139+
#
140+
141+
# List all default C defines here, like -D_DEBUG=1
142+
DDEFS =
143+
144+
# List all default ASM defines here, like -D_DEBUG=1
145+
DADEFS =
146+
147+
# List all default directories to look for include files here
148+
DINCDIR =
149+
150+
# List the default directory to look for the libraries here
151+
DLIBDIR =
152+
153+
# List all default libraries here
154+
DLIBS =
155+
156+
#
157+
# End of default section
158+
##############################################################################
159+
160+
##############################################################################
161+
# Start of user section
162+
#
163+
164+
# List all user C define here, like -D_DEBUG=1
165+
UDEFS =
166+
167+
# Define ASM defines here
168+
UADEFS =
169+
170+
# List all user directories here
171+
UINCDIR =
172+
173+
# List the user directory to look for the libraries here
174+
ULIBDIR =
175+
176+
# List all user libraries here
177+
ULIBS =
178+
179+
#
180+
# End of user defines
181+
##############################################################################
182+
183+
OUTFILES = $(BUILDDIR)/$(PROJECT).srec \
184+
$(BUILDDIR)/$(PROJECT).hex
185+
186+
include $(CHIBIOS)/os/ports/GCC/MIPS/rules.mk
187+
188+
$(BUILDDIR)/%.srec: $(BUILDDIR)/%.elf $(LDSCRIPT)
189+
ifeq ($(USE_VERBOSE_COMPILE),yes)
190+
$(SREC) $< $@
191+
else
192+
@echo Creating $@
193+
@$(SREC) $< $@
194+
endif
195+
196+
$(BUILDDIR)/%.hex: $(BUILDDIR)/%.elf $(LDSCRIPT)
197+
ifeq ($(USE_VERBOSE_COMPILE),yes)
198+
$(HEX) $< $@
199+
else
200+
@echo Creating $@
201+
@$(HEX) $< $@
202+
endif

0 commit comments

Comments
 (0)