mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Create a new board named NUCLEOF401RE
added this board to Makefile modified build_platform_config.py to avoid "module not found error"
This commit is contained in:
parent
eb02199f90
commit
67c00252ab
25
Makefile
25
Makefile
@ -1,6 +1,7 @@
|
||||
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
|
||||
#
|
||||
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
|
||||
# Copyright (C) 2014 Alain Sézille for NucleoF401RE specific lines of this file
|
||||
#
|
||||
# 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
|
||||
@ -34,6 +35,7 @@
|
||||
# LCTECH_STM32F103RBT6=1 # LC Technology STM32F103RBT6 Ebay boards
|
||||
# ARDUINOMEGA2560=1
|
||||
# ARMINARM=1
|
||||
NUCLEOF401RE=1
|
||||
# Or nothing for standard linux compile
|
||||
#
|
||||
# Also:
|
||||
@ -116,7 +118,7 @@ PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_hd.o
|
||||
OPTIMIZEFLAGS+=-O3
|
||||
else ifdef ESPRUINI_1V0
|
||||
EMBEDDED=1
|
||||
DEFINES+= -DUSE_USB_OTG_FS=1 -DESPRUINI -DESPRUINI_1V0
|
||||
DEFINES+= -DUSE_USB_OTG_FS=1 -DESPRUINI -DESPRUINI_1V0
|
||||
USE_GRAPHICS=1
|
||||
BOARD=ESPRUINIBOARD_R1_0
|
||||
STLIB=STM32F401xx
|
||||
@ -187,11 +189,17 @@ BOARD=ECU
|
||||
STLIB=STM32F40_41xxx
|
||||
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f40_41xxx.o
|
||||
OPTIMIZEFLAGS+=-O3
|
||||
else ifdef NUCLEOF401RE
|
||||
EMBEDDED=1
|
||||
BOARD=NUCLEOF401RE
|
||||
STLIB=STM32F401xx
|
||||
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f401xx.o
|
||||
OPTIMIZEFLAGS+=-O3
|
||||
else ifdef STM32F4DISCOVERY
|
||||
EMBEDDED=1
|
||||
USE_NET=1
|
||||
USE_GRAPHICS=1
|
||||
DEFINES += -DUSE_USB_OTG_FS=1
|
||||
DEFINES += -DUSE_USB_OTG_FS=1
|
||||
BOARD=STM32F4DISCOVERY
|
||||
STLIB=STM32F40_41xxx
|
||||
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f40_41xxx.o
|
||||
@ -200,7 +208,7 @@ else ifdef STM32F401CDISCOVERY
|
||||
EMBEDDED=1
|
||||
USE_NET=1
|
||||
USE_GRAPHICS=1
|
||||
DEFINES += -DUSE_USB_OTG_FS=1
|
||||
DEFINES += -DUSE_USB_OTG_FS=1
|
||||
BOARD=STM32F401CDISCOVERY
|
||||
STLIB=STM32F401xx
|
||||
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f401xx.o
|
||||
@ -208,7 +216,7 @@ OPTIMIZEFLAGS+=-O3
|
||||
else ifdef STM32F429IDISCOVERY
|
||||
EMBEDDED=1
|
||||
USE_GRAPHICS=1
|
||||
DEFINES += -DUSE_USB_OTG_FS=1
|
||||
DEFINES += -DUSE_USB_OTG_FS=1
|
||||
BOARD=STM32F429IDISCOVERY
|
||||
STLIB=STM32F429_439xx
|
||||
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f429_439xx.o
|
||||
@ -417,7 +425,7 @@ src/jswrap_serial.c \
|
||||
src/jswrap_spi_i2c.c \
|
||||
src/jswrap_stream.c \
|
||||
src/jswrap_string.c \
|
||||
src/jswrap_waveform.c
|
||||
src/jswrap_waveform.c
|
||||
|
||||
# it is important that _pin comes before stuff which uses
|
||||
# integers (as the check for int *includes* the chek for pin)
|
||||
@ -843,7 +851,7 @@ targetlibs/stm32f4/lib/stm32f4xx_tim.c \
|
||||
targetlibs/stm32f4/lib/stm32f4xx_usart.c \
|
||||
targetlibs/stm32f4/lib/stm32f4xx_wwdg.c \
|
||||
targetlibs/stm32f4/lib/system_stm32f4xx.c
|
||||
#targetlibs/stm32f4/lib/stm324xx_fsmc.c
|
||||
#targetlibs/stm32f4/lib/stm324xx_fsmc.c
|
||||
|
||||
ifdef USB
|
||||
INCLUDE += -I$(ROOT)/targetlibs/stm32f4/usblib -I$(ROOT)/targetlibs/stm32f4/usb
|
||||
@ -1112,6 +1120,11 @@ else ifdef OLIMEXINO_STM32_BOOTLOADER
|
||||
dfu-util -a1 -d 0x1EAF:0x0003 -D $(PROJ_NAME).bin
|
||||
else ifdef MBED
|
||||
cp $(PROJ_NAME).bin /media/MBED;sync
|
||||
else ifdef NUCLEOF401RE
|
||||
# TODO make it smarter with the destination folder, needs to take properly in account the user name
|
||||
# TODO this destination folder is somehow defined per default by the logged user when connecting the Nucleo board
|
||||
# TODO So at worst should be finnaly used in an environment var rather than hidden in the middle of this file
|
||||
cp $(PROJ_NAME).bin /media/$$USER/NUCLEO;sync
|
||||
else
|
||||
echo ST-LINK flash
|
||||
st-flash write $(PROJ_NAME).bin $(BASEADDRESS)
|
||||
|
||||
106
boards/NUCLEOF401RE.py
Normal file
106
boards/NUCLEOF401RE.py
Normal file
@ -0,0 +1,106 @@
|
||||
#!/bin/false
|
||||
# -*- coding: utf8 -*-
|
||||
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
|
||||
#
|
||||
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
|
||||
# Copyright (C) 2014 Alain Sézille for NucleoF401RE specific lines of this file
|
||||
#
|
||||
# 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 contains information for a specific board - the available pins, and where LEDs,
|
||||
# Buttons, and other in-built peripherals are. It is used to build documentation as well
|
||||
# as various source and header files for Espruino.
|
||||
# ----------------------------------------------------------------------------------------
|
||||
|
||||
import pinutils;
|
||||
info = {
|
||||
'name' : "NUCLEOF401RE",
|
||||
'link' : [ "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260000#tab-3"],
|
||||
'default_console' : "EV_SERIAL2", # USART2 par défaut USART2_TX sur PA2, USART2_RX sur PA3
|
||||
'variables' : 3040, # TODO A VERIFIER (à priori beaucoup plus car plus de RAM (96K au lieu de 64K pour 3040 var))
|
||||
'binary_name' : 'espruino_%v_nucleof401re.bin',
|
||||
};
|
||||
chip = {
|
||||
'part' : "STM32F401RET6",
|
||||
'family' : "STM32F4",
|
||||
'package' : "LQFP64",
|
||||
'ram' : 96,
|
||||
'flash' : 512,
|
||||
'speed' : 84,
|
||||
'usart' : 3,
|
||||
'spi' : 4,
|
||||
'i2c' : 3,
|
||||
'adc' : 1,
|
||||
'dac' : 0,
|
||||
'saved_code' : { # TODO A VERIFIER
|
||||
'address' : 0x08004000, # TODO A VERIFIER dépend de la taille du code compilé
|
||||
'page_size' : 16384, # size of pages
|
||||
'page_number' : 1, # number of page we start at (0 based)
|
||||
'pages' : 3, # number of pages we're using
|
||||
'flash_available' : 512 # binary will have a hole in it, so we just want to test against full size
|
||||
},
|
||||
'place_text_section' : 0x08010000, # note flash_available above # TODO A VERIFIER
|
||||
};
|
||||
# left-right, or top-bottom order
|
||||
# TODO A VERIFIER
|
||||
board = {
|
||||
'left' : [ 'C10', 'C12', 'VDD', 'BOOT0', 'NC', 'NC', 'A13', 'A14', 'A15', 'GND', 'B7', 'C13', 'C14', 'C15', 'H0', 'H1', 'VBAT', 'C2', 'C3'],
|
||||
'left2' : [ 'C11', 'D2', 'E5V', 'GND', 'NC', 'IOREF', 'RESET', '3V3', '5V', 'GND', 'GND', 'VIN', 'NC', 'A0', 'A1', 'A4', 'B0', 'C1', 'C0'],
|
||||
'left3' : [ 'NC', 'IOREF', 'RESET', '3V3', '5V', 'GND', 'GND', 'VIN', 'A0', 'A1', 'A4', 'B0', 'C1', 'C0'],
|
||||
'right3' : [ 'B8', 'B9', 'AVDD', 'GND', 'A5', 'A6', 'A7', 'B6','C7','A9','A8','B10','B4','B5','B3','A10','A2','A3'],
|
||||
'right2' : [ 'C9', 'B8', 'B9', 'AVDD', 'GND', 'A5', 'A6', 'A7', 'B6','C7','A9','A8','B10','B4','B5','B3','A10','A2','A3'],
|
||||
'right' : [ 'C8', 'C6', 'C5', 'U5V', 'NC', 'A12', 'A11', 'B12', 'NC', 'GND', 'B2', 'B1', 'B15', 'B14', 'B13', 'AGND', 'C4', 'NC', 'NC'],
|
||||
};
|
||||
devices = {
|
||||
'OSC' : { 'pin_1' : 'H0', # MCO from ST-LINK fixed at 8 Mhz, boards rev MB1136 C-02
|
||||
'pin_2' : 'H1' },
|
||||
'OSC_RTC' : { 'pin_1' : 'C14', # MB1136 C-02 corresponds to a board configured with on-board 32kHz oscillator
|
||||
'pin_2' : 'C15' },
|
||||
'LED1' : { 'pin' : 'A5' },
|
||||
# 'LED2' : { 'pin' : 'D12' },
|
||||
# 'LED3' : { 'pin' : 'D14' },
|
||||
# 'LED4' : { 'pin' : 'D15' },
|
||||
'BTN1' : { 'pin' : 'C13' },
|
||||
# 'USB' : { 'pin_otg_pwr' : 'C0',
|
||||
# 'pin_dm' : 'A11',
|
||||
# 'pin_dp' : 'A12',
|
||||
# 'pin_vbus' : 'A9',
|
||||
# 'pin_id' : 'A10', },
|
||||
};
|
||||
|
||||
|
||||
board_css = """
|
||||
#board {
|
||||
width: 680px;
|
||||
height: 1020px;
|
||||
left: 200px;
|
||||
background-image: url(img/NUCLEOF401RE.jpg);
|
||||
}
|
||||
#boardcontainer {
|
||||
height: 1020px;
|
||||
}
|
||||
#left {
|
||||
top: 375px;
|
||||
right: 590px;
|
||||
}
|
||||
#left2 {
|
||||
top: 375px;
|
||||
left: 105px;
|
||||
}
|
||||
|
||||
#right {
|
||||
top: 375px;
|
||||
left: 550px;
|
||||
}
|
||||
#right2 {
|
||||
top: 375px;
|
||||
right: 145px;
|
||||
}
|
||||
""";
|
||||
|
||||
def get_pins():
|
||||
pins = pinutils.scan_pin_file([], 'stm32f401.csv', 5, 8, 9)
|
||||
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
|
||||
BIN
boards/img/NUCLEOF401RE.jpg
Normal file
BIN
boards/img/NUCLEOF401RE.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
@ -21,9 +21,12 @@ import importlib;
|
||||
import common;
|
||||
|
||||
scriptdir = os.path.dirname(os.path.realpath(__file__))
|
||||
basedir = scriptdir+"/../"
|
||||
sys.path.append(basedir+"scripts");
|
||||
sys.path.append(basedir+"boards");
|
||||
# added os.path.normpath to get a correct reckognition of the subsequent path
|
||||
# by Ubuntu 14.04 LTS
|
||||
basedir = os.path.normpath(scriptdir+"/../")
|
||||
# added leading / as a consequence of use of os.path.normpath
|
||||
sys.path.append(basedir+"/scripts");
|
||||
sys.path.append(basedir+"/boards");
|
||||
|
||||
import pinutils;
|
||||
|
||||
@ -78,11 +81,11 @@ if not LINUX:
|
||||
flash_page_size = 1024 # just a guess
|
||||
flash_saved_code_sector = ""
|
||||
if board.chip["family"]=="STM32F1": flash_page_size = 1024 if "subfamily" in board.chip and board.chip["subfamily"]=="MD" else 2048
|
||||
if board.chip["family"]=="STM32F2":
|
||||
if board.chip["family"]=="STM32F2":
|
||||
flash_page_size = 128*1024
|
||||
flash_saved_code_sector = 11
|
||||
if board.chip["family"]=="STM32F3": flash_page_size = 2*1024
|
||||
if board.chip["family"]=="STM32F4":
|
||||
if board.chip["family"]=="STM32F4":
|
||||
flash_page_size = 128*1024
|
||||
flash_saved_code_sector = 11
|
||||
# F4 has different page sizes in different places
|
||||
@ -130,7 +133,7 @@ def codeOutDevice(device):
|
||||
codeOut("#define "+device+"_ONSTATE "+("0" if "inverted" in board.devices[device] else "1"))
|
||||
if "pinstate" in board.devices[device]:
|
||||
codeOut("#define "+device+"_PINSTATE JSHPINSTATE_GPIO_"+board.devices[device]["pinstate"]);
|
||||
|
||||
|
||||
def codeOutDevicePin(device, pin, definition_name):
|
||||
if device in board.devices:
|
||||
codeOut("#define "+definition_name+" "+toPinDef(board.devices[device][pin]))
|
||||
@ -165,7 +168,7 @@ elif board.chip["family"]=="STM32F3":
|
||||
board.chip["class"]="STM32"
|
||||
codeOut('#include "stm32f30x.h"')
|
||||
codeOut("#define STM32API2 // hint to jshardware that the API is a lot different")
|
||||
codeOut("#define USB_INT_DEFAULT") # hack
|
||||
codeOut("#define USB_INT_DEFAULT") # hack
|
||||
elif board.chip["family"]=="STM32F4":
|
||||
board.chip["class"]="STM32"
|
||||
codeOut('#include "stm32f4xx.h"')
|
||||
@ -212,7 +215,7 @@ if board.chip["class"]=="STM32":
|
||||
#define UTIL_TIMER_IRQHandler TIM5_IRQHandler
|
||||
#define UTIL_TIMER_APB1 RCC_APB1Periph_TIM5
|
||||
""")
|
||||
elif "subfamily" in board.chip and board.chip["subfamily"]=="MD":
|
||||
elif "subfamily" in board.chip and board.chip["subfamily"]=="MD":
|
||||
|
||||
codeOut("""
|
||||
// frustratingly the 103_MD (non-VL) chips in Olimexino don't have any timers other than 1-4
|
||||
@ -291,8 +294,8 @@ simpleDevices = [
|
||||
usedPinChecks = ["false"];
|
||||
ledChecks = ["false"];
|
||||
btnChecks = ["false"];
|
||||
for device in simpleDevices:
|
||||
if device in board.devices:
|
||||
for device in simpleDevices:
|
||||
if device in board.devices:
|
||||
codeOutDevice(device)
|
||||
check = "(PIN)==" + toPinDef(board.devices[device]["pin"])
|
||||
if device[:3]=="LED": ledChecks.append(check)
|
||||
@ -305,7 +308,7 @@ if "USB" in board.devices:
|
||||
|
||||
if "LCD" in board.devices:
|
||||
for i in range(0,16):
|
||||
codeOutDevicePin("LCD", "pin_d"+str(i), "LCD_FSMC_D"+str(i))
|
||||
codeOutDevicePin("LCD", "pin_d"+str(i), "LCD_FSMC_D"+str(i))
|
||||
codeOutDevicePin("LCD", "pin_rd", "LCD_FSMC_RD")
|
||||
codeOutDevicePin("LCD", "pin_wr", "LCD_FSMC_WR")
|
||||
codeOutDevicePin("LCD", "pin_cs", "LCD_FSMC_CS")
|
||||
@ -317,7 +320,7 @@ if "SD" in board.devices:
|
||||
if "pin_cs" in board.devices["SD"]: codeOutDevicePin("SD", "pin_cs", "SD_CS_PIN")
|
||||
if "pin_di" in board.devices["SD"]: codeOutDevicePin("SD", "pin_di", "SD_DI_PIN")
|
||||
if "pin_do" in board.devices["SD"]: codeOutDevicePin("SD", "pin_do", "SD_DO_PIN")
|
||||
if "pin_clk" in board.devices["SD"]:
|
||||
if "pin_clk" in board.devices["SD"]:
|
||||
codeOutDevicePin("SD", "pin_clk", "SD_CLK_PIN")
|
||||
sdClkPin = pinutils.findpin(pins, "P"+board.devices["SD"]["pin_clk"], False)
|
||||
spiNum = 0
|
||||
@ -329,7 +332,7 @@ if "SD" in board.devices:
|
||||
|
||||
for device in ["USB","SD","LCD","JTAG"]:
|
||||
if device in board.devices:
|
||||
for entry in board.devices[device]:
|
||||
for entry in board.devices[device]:
|
||||
if entry[:3]=="pin": usedPinChecks.append("(PIN)==" + toPinDef(board.devices[device][entry])+"/* "+device+" */")
|
||||
|
||||
codeOut("")
|
||||
@ -343,5 +346,3 @@ codeOut("#define IS_PIN_A_BUTTON(PIN) (("+")||(".join(btnChecks)+"))")
|
||||
codeOut("""
|
||||
#endif // _PLATFORM_CONFIG_H
|
||||
""");
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user