Added 'Nucleo' class for STM32 nucleo boards

This commit is contained in:
Gordon Williams 2014-11-07 12:58:40 +00:00
parent fa69aca8d0
commit 4ece36249b
5 changed files with 100 additions and 1 deletions

View File

@ -201,6 +201,7 @@ PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f40_41xxx.o
OPTIMIZEFLAGS+=-O3
else ifdef NUCLEOF401RE
EMBEDDED=1
NUCLEO=1
BOARD=NUCLEOF401RE
STLIB=STM32F401xx
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f401xx.o
@ -997,6 +998,10 @@ targets/linux/jshardware.c
LIBS += -lm # maths lib
endif
ifdef NUCLEO
WRAPPERSOURCES += targets/nucleo/jswrap_nucleo.c
endif
SOURCES += $(WRAPPERSOURCES)
SOURCEOBJS = $(SOURCES:.c=.o) $(CPPSOURCES:.cpp=.o)
OBJS = $(SOURCEOBJS) $(PRECOMPILED_OBJS)
@ -1131,7 +1136,8 @@ else ifdef OLIMEXINO_STM32_BOOTLOADER
else ifdef MBED
cp $(PROJ_NAME).bin /media/MBED;sync
else ifdef NUCLEOF401RE
cp $(PROJ_NAME).bin /media/$(USER)/NUCLEO;sync
if [ -d "/media/$(USER)/NUCLEO" ]; then cp $(PROJ_NAME).bin /media/$(USER)/NUCLEO;sync; fi
if [ -d "/media/NUCLEO" ]; then cp $(PROJ_NAME).bin /media/NUCLEO;sync; fi
else
echo ST-LINK flash
st-flash write $(PROJ_NAME).bin $(BASEADDRESS)

View File

@ -74,6 +74,8 @@ devices = {
# 'pin_dp' : 'A12',
# 'pin_vbus' : 'A9',
# 'pin_id' : 'A10', },
'NUCLEO_A' : [ 'A0','A1','A4','B0','C1','C0' ],
'NUCLEO_D' : [ 'A3','A2','A10','B3','B5','B4','B10','A8','A9','C7','B6','A7','A6','A5','B9','B8' ],
};

View File

@ -335,6 +335,14 @@ for device in ["USB","SD","LCD","JTAG"]:
for entry in board.devices[device]:
if entry[:3]=="pin": usedPinChecks.append("(PIN)==" + toPinDef(board.devices[device][entry])+"/* "+device+" */")
# Specific hacks for nucleo boards
if "NUCLEO_A" in board.devices:
for n,pin in enumerate(board.devices["NUCLEO_A"]):
codeOut("#define NUCLEO_A"+str(n)+" "+toPinDef(pin))
if "NUCLEO_D" in board.devices:
for n,pin in enumerate(board.devices["NUCLEO_D"]):
codeOut("#define NUCLEO_D"+str(n)+" "+toPinDef(pin))
codeOut("")
codeOut("// definition to avoid compilation when Pin/platform config is not defined")

View File

@ -0,0 +1,70 @@
/*
* This file is part of Espruino, a JavaScript interpreter for Microcontrollers
*
* Copyright (C) 2014 Gordon Williams <gw@pur3.co.uk>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* ----------------------------------------------------------------------------
* This file is designed to be parsed during the build process
*
* Nucleo-specific pin namings
* ----------------------------------------------------------------------------
*/
#include "jswrap_nucleo.h"
/*JSON{
"type" : "class",
"class" : "Nucleo"
}
This is the built-in class for the Arduino-style pin namings on ST Nucleo boards
*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "A0", "generate_full" : "NUCLEO_A0", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "A1", "generate_full" : "NUCLEO_A1", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "A2", "generate_full" : "NUCLEO_A2", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "A3", "generate_full" : "NUCLEO_A3", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "A4", "generate_full" : "NUCLEO_A4", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "A5", "generate_full" : "NUCLEO_A5", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D0", "generate_full" : "NUCLEO_D0", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D1", "generate_full" : "NUCLEO_D1", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D2", "generate_full" : "NUCLEO_D2", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D3", "generate_full" : "NUCLEO_D3", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D4", "generate_full" : "NUCLEO_D4", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D5", "generate_full" : "NUCLEO_D5", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D6", "generate_full" : "NUCLEO_D6", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D7", "generate_full" : "NUCLEO_D7", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D8", "generate_full" : "NUCLEO_D8", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D9", "generate_full" : "NUCLEO_D9", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D10", "generate_full" : "NUCLEO_D10", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D11", "generate_full" : "NUCLEO_D11", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D12", "generate_full" : "NUCLEO_D12", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D13", "generate_full" : "NUCLEO_D13", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D14", "generate_full" : "NUCLEO_D14", "return" : ["pin","A Pin"]
}*/
/*JSON{"type" : "staticproperty","class" : "Nucleo","name" : "D15", "generate_full" : "NUCLEO_D15", "return" : ["pin","A Pin"]
}*/

View File

@ -0,0 +1,13 @@
/*
* This file is part of Espruino, a JavaScript interpreter for Microcontrollers
*
* Copyright (C) 2014 Gordon Williams <gw@pur3.co.uk>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* ----------------------------------------------------------------------------
* Nucleo-specific pin namings
* ----------------------------------------------------------------------------
*/