Fix for clean PIC32 compile with DEBUG on
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3639 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
f2fcf596a0
commit
7c1bb4bce3
@ -137,7 +137,7 @@ static void up_registerdump(uint32_t *regs)
|
|||||||
#ifdef CONFIG_NUTTX_KERNEL
|
#ifdef CONFIG_NUTTX_KERNEL
|
||||||
static inline void dispatch_syscall(uint32_t *regs)
|
static inline void dispatch_syscall(uint32_t *regs)
|
||||||
{
|
{
|
||||||
uint32_t cmd = regs[REG_R0];
|
uint32_t cmd = regs[REG_A0];
|
||||||
FAR _TCB *rtcb = sched_self();
|
FAR _TCB *rtcb = sched_self();
|
||||||
uintptr_t ret = (uintptr_t)ERROR;
|
uintptr_t ret = (uintptr_t)ERROR;
|
||||||
|
|
||||||
@ -182,43 +182,43 @@ static inline void dispatch_syscall(uint32_t *regs)
|
|||||||
/* Number of parameters: 1 */
|
/* Number of parameters: 1 */
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
ret = g_stublookup[index].stub1(regs[REG_R5]);
|
ret = g_stublookup[index].stub1(regs[REG_A1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Number of parameters: 2 */
|
/* Number of parameters: 2 */
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
ret = g_stublookup[index].stub2(regs[REG_R5], regs[REG_R6]);
|
ret = g_stublookup[index].stub2(regs[REG_A1], regs[REG_A2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Number of parameters: 3 */
|
/* Number of parameters: 3 */
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
ret = g_stublookup[index].stub3(regs[REG_R5], regs[REG_R6],
|
ret = g_stublookup[index].stub3(regs[REG_A1], regs[REG_A2],
|
||||||
regs[REG_R7]);
|
regs[REG_A3]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Number of parameters: 4 */
|
/* Number of parameters: 4 */
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
ret = g_stublookup[index].stub4(regs[REG_R5], regs[REG_R6],
|
ret = g_stublookup[index].stub4(regs[REG_A1], regs[REG_A2],
|
||||||
regs[REG_R7], regs[REG_R8]);
|
regs[REG_A3], regs[REG_T0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Number of parameters: 5 */
|
/* Number of parameters: 5 */
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
ret = g_stublookup[index].stub5(regs[REG_R5], regs[REG_R6],
|
ret = g_stublookup[index].stub5(regs[REG_A1], regs[REG_A2],
|
||||||
regs[REG_R7], regs[REG_R8],
|
regs[REG_A3], regs[REG_T0],
|
||||||
regs[REG_R9]);
|
regs[REG_T1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Number of parameters: 6 */
|
/* Number of parameters: 6 */
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
ret = g_stublookup[index].stub6(regs[REG_R5], regs[REG_R6],
|
ret = g_stublookup[index].stub6(regs[REG_A1], regs[REG_A2],
|
||||||
regs[REG_R7], regs[REG_R8],
|
regs[REG_A3], regs[REG_T0],
|
||||||
regs[REG_R9], regs[REG_R10]);
|
regs[REG_T1], regs[REG_T2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Unsupported number of paramters. Report error and return ERROR */
|
/* Unsupported number of paramters. Report error and return ERROR */
|
||||||
@ -245,10 +245,10 @@ static inline void dispatch_syscall(uint32_t *regs)
|
|||||||
regs = rtcb->xcp.regs;
|
regs = rtcb->xcp.regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then return the result in R0 */
|
/* Then return the result in v0 */
|
||||||
|
|
||||||
swidbg("Return value regs: %p value: %d\n", regs, ret);
|
swidbg("Return value regs: %p value: %d\n", regs, ret);
|
||||||
regs[REG_R0] = (uint32_t)ret;
|
regs[REG_v0] = (uint32_t)ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -271,8 +271,9 @@ int up_swint0(int irq, FAR void *context)
|
|||||||
|
|
||||||
DEBUGASSERT(regs && regs == current_regs);
|
DEBUGASSERT(regs && regs == current_regs);
|
||||||
|
|
||||||
/* Software interrupt 0 is invoked with REG_R4 = system call command and
|
/* Software interrupt 0 is invoked with REG_A0 (REG_R4) = system call
|
||||||
* REG_R5..R10 = variable number of arguments depending on the system call.
|
* command and REG_A1-3 and REG_T0-2 (REG_R5-10) = variable number of
|
||||||
|
* arguments depending on the system call.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG_SWINT0
|
#ifdef DEBUG_SWINT0
|
||||||
@ -301,8 +302,8 @@ int up_swint0(int irq, FAR void *context)
|
|||||||
|
|
||||||
case SYS_restore_context:
|
case SYS_restore_context:
|
||||||
{
|
{
|
||||||
DEBUGASSERT(regs[REG_R5] != 0);
|
DEBUGASSERT(regs[REG_A1] != 0);
|
||||||
current_regs = (uint32_t*)regs[REG_R5];
|
current_regs = (uint32_t*)regs[REG_A1];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -324,9 +325,9 @@ int up_swint0(int irq, FAR void *context)
|
|||||||
|
|
||||||
case SYS_switch_context:
|
case SYS_switch_context:
|
||||||
{
|
{
|
||||||
DEBUGASSERT(regs[REG_R5] != 0 && regs[REG_R6] != 0);
|
DEBUGASSERT(regs[REG_A1] != 0 && regs[REG_A2] != 0);
|
||||||
memcpy((uint32_t*)regs[REG_R5], regs, XCPTCONTEXT_SIZE);
|
memcpy((uint32_t*)regs[REG_A1], regs, XCPTCONTEXT_SIZE);
|
||||||
current_regs = (uint32_t*)regs[REG_R6];
|
current_regs = (uint32_t*)regs[REG_A2];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -339,7 +340,7 @@ int up_swint0(int irq, FAR void *context)
|
|||||||
#ifdef CONFIG_NUTTX_KERNEL
|
#ifdef CONFIG_NUTTX_KERNEL
|
||||||
dispatch_syscall(regs);
|
dispatch_syscall(regs);
|
||||||
#else
|
#else
|
||||||
slldbg("ERROR: Bad SYS call: %d\n", regs[REG_R0]);
|
slldbg("ERROR: Bad SYS call: %d\n", regs[REG_A0]);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -354,7 +355,7 @@ int up_swint0(int irq, FAR void *context)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swidbg("SWInt Return: %d\n", regs[REG_R2]);
|
swidbg("SWInt Return: %d\n", regs[REG_V0]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -484,6 +484,19 @@
|
|||||||
# error "CONFIG_PIC32MX_USBPRIO is too large"
|
# error "CONFIG_PIC32MX_USBPRIO is too large"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* SYS calls ************************************************************************/
|
||||||
|
/* SYS call 0 and 1 are defined for internal use by the PIC32MX port (see
|
||||||
|
* arch/mips/include/mips32/syscall.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_NUTTX_KERNEL
|
||||||
|
# if !defined(CONFIG_SYS_RESERVED) || CONFIG_SYS_RESERVED < 2
|
||||||
|
# error "CONFIG_SYS_RESERVED must be defined to be 2 for a kernel build"
|
||||||
|
# elif CONFIG_SYS_RESERVED > 2
|
||||||
|
# warning "CONFIG_SYS_RESERVED should be defined to be 2 for a kernel build"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* UARTs ****************************************************************************/
|
/* UARTs ****************************************************************************/
|
||||||
/* Don't enable UARTs not supported by the chip. */
|
/* Don't enable UARTs not supported by the chip. */
|
||||||
|
|
||||||
|
@ -41,10 +41,13 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
#include <arch/pic32mx/cp0.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
|
@ -9,10 +9,157 @@ MCU plus voltage regulation, debug interface, and an OTG connector.
|
|||||||
Contents
|
Contents
|
||||||
========
|
========
|
||||||
|
|
||||||
|
PIC32MX460F512L Pin Out
|
||||||
|
MAX3232 Connection
|
||||||
Toolchains
|
Toolchains
|
||||||
PIC32MX Configuration Options
|
PIC32MX Configuration Options
|
||||||
Configurations
|
Configurations
|
||||||
|
|
||||||
|
PIC32MX460F512L Pin Out
|
||||||
|
=======================
|
||||||
|
|
||||||
|
PIC32MX460F512L 100-Pin TQFP (USB) Pin Out. The mapping to the pins on
|
||||||
|
the PCL Logic board are very simple, each pin is brought out to a connector
|
||||||
|
label with the PIC32MX460F512L pin number.
|
||||||
|
|
||||||
|
On board logic only manages power, crystal, and USB signals.
|
||||||
|
|
||||||
|
LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
|
||||||
|
PIN NAME
|
||||||
|
---- ----------------------------
|
||||||
|
1 RG15
|
||||||
|
2 Vdd
|
||||||
|
3 PMD5/RE5
|
||||||
|
4 PMD6/RE6
|
||||||
|
5 PMD7/RE7
|
||||||
|
6 T2CK/RC1
|
||||||
|
7 T3CK/RC2
|
||||||
|
8 T4CK/RC3
|
||||||
|
9 T5CK/SDI1/RC4
|
||||||
|
10 SCK2/PMA5/CN8/RG6
|
||||||
|
11 SDI2/PMA4/CN9/RG7
|
||||||
|
12 SDO2/PMA3/CN10/RG8
|
||||||
|
13 MCLR
|
||||||
|
14 SS2/PMA2/CN11/RG9
|
||||||
|
15 Vss
|
||||||
|
16 Vdd
|
||||||
|
17 TMS/RA0
|
||||||
|
18 INT1/RE8
|
||||||
|
19 INT2/RE9
|
||||||
|
20 AN5/C1IN+/VBUSON/CN7/RB5
|
||||||
|
21 AN4/C1IN-/CN6/RB4
|
||||||
|
22 AN3/C2IN+/CN5/RB3
|
||||||
|
23 AN2/C2IN-/CN4/RB2
|
||||||
|
24 PGEC1/AN1/CN3/RB1
|
||||||
|
25 PGED1/AN0/CN2/RB0
|
||||||
|
|
||||||
|
BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
|
||||||
|
PIN NAME
|
||||||
|
---- ----------------------------
|
||||||
|
26 PGEC2/AN6/OCFA/RB6
|
||||||
|
27 PGED2/AN7/RB7
|
||||||
|
28 VREF-/CVREF-/PMA7/RA9
|
||||||
|
29 VREF+/CVREF+/PMA6/RA10
|
||||||
|
30 AVdd
|
||||||
|
31 AVss
|
||||||
|
32 AN8/C1OUT/RB8
|
||||||
|
33 AN9/C2OUT/RB9
|
||||||
|
34 AN10/CVREFOUT/PMA13/RB10
|
||||||
|
35 AN11/PMA12/RB11
|
||||||
|
36 Vss
|
||||||
|
37 Vdd
|
||||||
|
38 TCK/RA1
|
||||||
|
39 U2RTS/RF13
|
||||||
|
40 U2CTS/RF12
|
||||||
|
41 AN12/PMA11/RB12
|
||||||
|
42 AN13/PMA10/RB13
|
||||||
|
43 AN14/PMALH/PMA1/RB14
|
||||||
|
44 AN15/OCFB/PMALL/PMA0/CN12/RB15
|
||||||
|
45 Vss
|
||||||
|
46 Vdd
|
||||||
|
47 U1CTS/CN20/RD14
|
||||||
|
48 U1RTS/CN21/RD15
|
||||||
|
49 U2RX/PMA9/CN17/RF4
|
||||||
|
50 U2TX/PMA8/CN18/RF5
|
||||||
|
|
||||||
|
RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
|
||||||
|
PIN NAME
|
||||||
|
---- ----------------------------
|
||||||
|
75 Vss
|
||||||
|
74 SOSCO/T1CK/CN0/RC14
|
||||||
|
73 SOSCI/CN1/RC13
|
||||||
|
72 SDO1/OC1/INT0/RD0
|
||||||
|
71 IC4/PMCS1/PMA14/RD11
|
||||||
|
70 SCK1/IC3/PMCS2/PMA15/RD10
|
||||||
|
69 SS1/IC2/RD9
|
||||||
|
68 RTCC/IC1/RD8
|
||||||
|
67 SDA1/INT4/RA15
|
||||||
|
66 SCL1/INT3/RA14
|
||||||
|
65 Vss
|
||||||
|
64 OSC2/CLKO/RC15
|
||||||
|
63 OSC1/CLKI/RC12
|
||||||
|
62 Vdd
|
||||||
|
61 TDO/RA5
|
||||||
|
60 TDI/RA4
|
||||||
|
59 SDA2/RA3
|
||||||
|
58 SCL2/RA2
|
||||||
|
57 D+/RG2
|
||||||
|
56 D-/RG3
|
||||||
|
55 VUSB
|
||||||
|
54 VBUS
|
||||||
|
53 U1TX/RF8
|
||||||
|
52 U1RX/RF2
|
||||||
|
51 USBID/RF3
|
||||||
|
|
||||||
|
TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
|
||||||
|
PIN NAME
|
||||||
|
---- ----------------------------
|
||||||
|
100 PMD4/RE4
|
||||||
|
99 PMD3/RE3
|
||||||
|
98 PMD2/RE2
|
||||||
|
97 TRD0/RG13
|
||||||
|
96 TRD1/RG12
|
||||||
|
95 TRD2/RG14
|
||||||
|
94 PMD1/RE1
|
||||||
|
93 PMD0/RE0
|
||||||
|
92 TRD3/RA7
|
||||||
|
91 TRCLK/RA6
|
||||||
|
90 PMD8/RG0
|
||||||
|
89 PMD9/RG1
|
||||||
|
88 PMD10/RF1
|
||||||
|
87 PMD11/RF0
|
||||||
|
86 ENVREG
|
||||||
|
85 Vcap/Vddcore
|
||||||
|
84 PMD15/CN16/RD7
|
||||||
|
83 PMD14/CN15/RD6
|
||||||
|
82 PMRD/CN14/RD5
|
||||||
|
81 OC5/PMWR/CN13/RD4
|
||||||
|
80 PMD13/CN19/RD13
|
||||||
|
79 IC5/PMD12/RD12
|
||||||
|
78 OC4/RD3
|
||||||
|
77 OC3/RD2
|
||||||
|
76 OC2/RD1
|
||||||
|
|
||||||
|
Additional Signals available from the board:
|
||||||
|
|
||||||
|
PROGRAM CONNECTOR: Vpp Vdd GND PGED1 PGEC1 NC PGED2 PGEC2
|
||||||
|
POWER POINTS: +5Vin +3.3V AVdd AGND Vdd GND USB+5V
|
||||||
|
|
||||||
|
MAX3232 Connection
|
||||||
|
==================
|
||||||
|
|
||||||
|
I use a tiny, MAX3232 board that I got from the eBay made by NKC
|
||||||
|
Electronics (http://www.nkcelectronics.com/). As of this writing, it
|
||||||
|
is also available here: http://www.nkcelectronics.com/rs232-to-ttl-3v--55v-convert232356.html
|
||||||
|
|
||||||
|
CTS -- Not connected
|
||||||
|
RTS -- Not connected
|
||||||
|
TX -- Pin 53: U1TX/RF8
|
||||||
|
RX -- Pin 52: U1RX/RF2
|
||||||
|
GND -- POWER POINT: GND
|
||||||
|
Vcc -- POWER POINT: Vdd (3.3V) -- Or P32_VBUS (+5V)
|
||||||
|
-- Or +5V from a USB PC port.
|
||||||
|
|
||||||
Toolchains
|
Toolchains
|
||||||
==========
|
==========
|
||||||
|
|
||||||
@ -66,7 +213,7 @@ Toolchains
|
|||||||
building on C:), then you may need to modify tools/mkdeps.sh
|
building on C:), then you may need to modify tools/mkdeps.sh
|
||||||
|
|
||||||
PIC32MX Configuration Options
|
PIC32MX Configuration Options
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
=============================
|
||||||
|
|
||||||
General Architecture Settings:
|
General Architecture Settings:
|
||||||
|
|
||||||
@ -246,7 +393,7 @@ PIC32MX Configuration Options
|
|||||||
PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
|
PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
|
||||||
|
|
||||||
Configurations
|
Configurations
|
||||||
^^^^^^^^^^^^^^
|
==============
|
||||||
|
|
||||||
Each PIC32MX configuration is maintained in a sudirectory and can be
|
Each PIC32MX configuration is maintained in a sudirectory and can be
|
||||||
selected as follow:
|
selected as follow:
|
||||||
|
@ -166,4 +166,4 @@ int fputs(FAR const char *s, FAR FILE *stream)
|
|||||||
}
|
}
|
||||||
return nput;
|
return nput;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user