Skip to content

Commit

Permalink
Pixl.js: Remove Wiznet W5100 support from default build (there's now …
Browse files Browse the repository at this point in the history
…a espruino_#v##_pixljs_wiznet.zip without JIT enabled) to ensure we have enough flash to continue builds
  • Loading branch information
gfwilliams committed Nov 15, 2024
1 parent 957e3f9 commit 9cbae63
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
strategy:
# devices to build for
matrix:
board: [PUCKJS, PIXLJS, JOLTJS, MDBT42Q, BANGLEJS, BANGLEJS2, PUCKJS_MINIMAL, PUCKJS_NETWORK]
board: [PUCKJS, PIXLJS, JOLTJS, MDBT42Q, BANGLEJS, BANGLEJS2, PUCKJS_MINIMAL, PUCKJS_NETWORK, PIXLJS_WIZ]
# try and build for all devices even if one fails
fail-fast: false
steps:
Expand Down
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
Graphics: Fix issue where drawLine for 2px horizontal lines only drew a 1px dot
nRF52: Add E.setComparator to enable interrupts from LPCOMP
Add Serial.isConnected to check if Bluetooth/USB/etc actually connected
Pixl.js: Remove Wiznet W5100 support from default build (there's now a espruino_#v##_pixljs_wiznet.zip without JIT enabled) to ensure we have enough flash to continue builds

2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Expand Down
4 changes: 2 additions & 2 deletions boards/PIXLJS.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
# Copyright (C) 2024 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
Expand Down Expand Up @@ -43,7 +43,7 @@
'TERMINAL'
],
'makefile' : [
'WIZNET=1','W5100=1', # Add WIZnet support - W5100 is the most common Arduino shield
#'WIZNET=1','W5100=1', # Add WIZnet support - W5100 is the most common Arduino shield
'DEFINES+=-DHAL_NFC_ENGINEERING_BC_FTPAN_WORKAROUND=1', # Looks like proper production nRF52s had this issue
# 'DEFINES+=-DCONFIG_GPIO_AS_PINRESET', # Allow the reset pin to work
'DEFINES += -DNRF_BLE_GATT_MAX_MTU_SIZE=53 -DNRF_BLE_MAX_MTU_SIZE=53', # increase MTU from default of 23
Expand Down
207 changes: 207 additions & 0 deletions boards/PIXLJS_WIZ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2024 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 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' : "Pixl.js with WIZnet W5100 Ethernet support",
'link' : [ "https://espruino.com/Pixl.js" ],
'boardname' : "PIXLJS",
'espruino_page_link' : 'Pixl.js',
'default_console' : "EV_SERIAL1",
'default_console_tx' : "D1",
'default_console_rx' : "D0",
'default_console_baudrate' : "9600",
'variables' : 2950, # How many variables are allocated for Espruino to use. RAM will be overflowed if this number is too high and code won't compile.
'bootloader' : 1,
'binary_name' : 'espruino_%v_pixljs_wiznet.hex',
'build' : {
'optimizeflags' : '-Os',
'libraries' : [
'BLUETOOTH',
'NET',
'GRAPHICS',
'NFC',
'NEOPIXEL',
'PIXLJS',
'CRYPTO',
#'SHA256',
#'AES',
'FILESYSTEM',
#'JIT',
'TERMINAL'
],
'makefile' : [
'WIZNET=1','W5100=1', # Add WIZnet support - W5100 is the most common Arduino shield
'DEFINES+=-DHAL_NFC_ENGINEERING_BC_FTPAN_WORKAROUND=1', # Looks like proper production nRF52s had this issue
# 'DEFINES+=-DCONFIG_GPIO_AS_PINRESET', # Allow the reset pin to work
'DEFINES += -DNRF_BLE_GATT_MAX_MTU_SIZE=53 -DNRF_BLE_MAX_MTU_SIZE=53', # increase MTU from default of 23
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'LDFLAGS += -Xlinker --defsym=LD_APP_RAM_BASE=0x3290', # set RAM base to match MTU=53 + CENTRAL_LINK_COUNT=2
'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"Pixl.js"\'',
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_pixljs_getBattery',
'DEFINES+=-DNFC_DEFAULT_URL=\'"https://www.espruino.com/ide"\'',
'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'',
'DEFINES+=-DNEOPIXEL_SCK_PIN=14 -DNEOPIXEL_LRCK_PIN=15', # see https://github.com/espruino/Espruino/issues/2071
'DEFINES += -DESPR_USE_STEPPER_TIMER=1', # Build in the code for stepping using the timer
'DEFINES+=-DSAVE_ON_FLASH_MATH',
'DFU_PRIVATE_KEY=targets/nrf5x_dfu/dfu_private_key.pem',
'DFU_SETTINGS=--application-version 0xff --hw-version 52 --sd-req 0x8C,0x91',
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
'DEFINES+=-DESPR_LIMIT_DATE_RANGE', # limits the acceptable range for Date years (saves a few hundred bytes)
'DEFINES+=-DESPR_NO_BLUETOOTH_MESSAGES', # don't include text versions of Bluetooth error messages (just the error number)
'DEFINES+=-DESPR_NO_REGEX_OPTIMISE', # save some storage space
'INCLUDE += -I$(ROOT)/libs/pixljs',
'WRAPPERSOURCES += libs/pixljs/jswrap_pixljs.c',
'JSMODULESOURCES += libs/js/graphical_menu.min.js'
]
}
};


chip = {
'part' : "NRF52832",
'family' : "NRF52",
'package' : "QFN48",
'ram' : 64,
'flash' : 512,
'speed' : 64,
'usart' : 1,
'spi' : 1,
'i2c' : 1,
'adc' : 1,
'dac' : 0,
'saved_code' : {
'address' : ((118 - 9) * 4096), # Bootloader takes pages 120-127, FS takes 118-119
'page_size' : 4096,
'pages' : 9,
'flash_available' : 512 - ((31 + 8 + 2 + 9)*4) # Softdevice uses 31 pages of flash, bootloader 8, FS 2, code 10. Each page is 4 kb.
},
};

devices = {
'LED1' : { 'pin' : 'H0' }, # Pin negated in software
'BTN1' : { 'pin' : 'H1', 'pinstate' : 'IN_PULLDOWN' }, # Pin negated in software
'BTN2' : { 'pin' : 'H2', 'pinstate' : 'IN_PULLDOWN' }, # Pin negated in software
'BTN3' : { 'pin' : 'H3', 'pinstate' : 'IN_PULLDOWN' }, # Pin negated in software
'BTN4' : { 'pin' : 'H4', 'pinstate' : 'IN_PULLDOWN' }, # Pin negated in software
'LCD' : {
'width' : 128, 'height' : 64, 'bpp' : 1,
'controller' : 'st7567',
'pin_dc' : 'H5',
'pin_cs' : 'H6',
'pin_rst' : 'H7',
'pin_sck' : 'H8',
'pin_mosi' : 'H9',
'pin_backlight' : 'H0',
},
};

# left-right, or top-bottom order
board = {
'top' : [ 'D0','D1','D2','D3','D4','D5','D6','D7','','D8','D9','D10','D11','D12','D13','GND','','A4','A5' ],
'bottom' : [ 'A5','A4','A3','A2','A1','A0','','Vin','GND','GND','5V','3.3V','RST','3.3V','','','GND','Vin'],
'bottom2' : [ '3.3V','SWIO','SWCK','GND'],

'_notes' : {
'D0' : "Serial Console RX when Bluetooth disconnected",
'D1' : "Serial Console TX when Bluetooth disconnected",
'A4' : "Also used for the pin marked SDA",
'A5' : "Also used for the pin marked SCL",
'H8' : "This is used as SCK when driving Neopixels with 'require('neopixel').write'. It will not affect the LCD as CS won't be asserted.",
'H9' : "This is used as LRCK when driving Neopixels with 'require('neopixel').write'. It will not affect the LCD as CS won't be asserted.",
'5V' : "Pixl.js has no 5v rail so this is not connected by default. A solder jumper can be used to connect it to Vin or 3.3v"
}
};
board["_css"] = """
#board {
width: 650px;
height: 568px;
top: 100px;
left : 100px;
background-image: url(img/PIXLJS.png);
}
#boardcontainer {
height: 800px;
}
#top {
bottom: 553px;
left: 74px;
}
#bottom {
top: 555px;
left: 74px;
}
#bottom2 {
top: 374px;
left: 64px;
}
.toppin { width: 21px; }
.bottompin { width: 21px; }
.bottom2pin { width: 21px; }
""";

def get_pins():
pins = [
{ "name":"PD0", "sortingname":"D00", "port":"D", "num":"25", "functions":{}, "csv":{} },
{ "name":"PD1", "sortingname":"D01", "port":"D", "num":"26", "functions":{}, "csv":{} },
{ "name":"PD2", "sortingname":"D02", "port":"D", "num":"27", "functions":{}, "csv":{} },
{ "name":"PD3", "sortingname":"D03", "port":"D", "num":"30", "functions":{ "ADC1_IN6":0 }, "csv":{} },
{ "name":"PD4", "sortingname":"D04", "port":"D", "num":"31", "functions":{ "ADC1_IN7":0 }, "csv":{} },
{ "name":"PD5", "sortingname":"D05", "port":"D", "num":"0", "functions":{}, "csv":{} },
{ "name":"PD6", "sortingname":"D06", "port":"D", "num":"1", "functions":{}, "csv":{} },
{ "name":"PD7", "sortingname":"D07", "port":"D", "num":"6", "functions":{}, "csv":{} },
{ "name":"PD8", "sortingname":"D08", "port":"D", "num":"7", "functions":{}, "csv":{} },
{ "name":"PD9", "sortingname":"D09", "port":"D", "num":"8", "functions":{}, "csv":{} },
{ "name":"PD10", "sortingname":"D10", "port":"D", "num":"17", "functions":{}, "csv":{} },
{ "name":"PD11", "sortingname":"D11", "port":"D", "num":"18", "functions":{}, "csv":{} },
{ "name":"PD12", "sortingname":"D12", "port":"D", "num":"19", "functions":{}, "csv":{} },
{ "name":"PD13", "sortingname":"D13", "port":"D", "num":"20", "functions":{}, "csv":{} },

{ "name":"PA0", "sortingname":"A00", "port":"A", "num":"2", "functions":{ "ADC1_IN0":0 }, "csv":{} },
{ "name":"PA1", "sortingname":"A01", "port":"A", "num":"3", "functions":{ "ADC1_IN1":0 }, "csv":{} },
{ "name":"PA2", "sortingname":"A02", "port":"A", "num":"4", "functions":{ "ADC1_IN2":0 }, "csv":{} },
{ "name":"PA3", "sortingname":"A03", "port":"A", "num":"5", "functions":{ "ADC1_IN3":0 }, "csv":{} },
{ "name":"PA4", "sortingname":"A04", "port":"A", "num":"28", "functions":{ "ADC1_IN4":0 }, "csv":{} },
{ "name":"PA5", "sortingname":"A05", "port":"A", "num":"29", "functions":{ "ADC1_IN5":0 }, "csv":{} },

{ "name":"PH0", "sortingname":"H0", "port":"H", "num":"16", "functions":{}, "csv":{} }, # LED
{ "name":"PH1", "sortingname":"H1", "port":"H", "num":"23", "functions":{}, "csv":{} }, # BTN1
{ "name":"PH2", "sortingname":"H2", "port":"H", "num":"21", "functions":{}, "csv":{} }, # 2
{ "name":"PH3", "sortingname":"H3", "port":"H", "num":"22", "functions":{}, "csv":{} }, # 3
{ "name":"PH4", "sortingname":"H4", "port":"H", "num":"24", "functions":{}, "csv":{} }, # 4
{ "name":"PH5", "sortingname":"H5", "port":"H", "num":"13", "functions":{}, "csv":{} }, # LCD DC
{ "name":"PH6", "sortingname":"H6", "port":"H", "num":"12", "functions":{}, "csv":{} }, # LCD CS
{ "name":"PH7", "sortingname":"H7", "port":"H", "num":"11", "functions":{}, "csv":{} }, # LCD RST
{ "name":"PH8", "sortingname":"H8", "port":"H", "num":"14", "functions":{}, "csv":{} }, # LCD SCK
{ "name":"PH9", "sortingname":"H9", "port":"H", "num":"15", "functions":{}, "csv":{} }, # LCD MOSI
];
# Make buttons and LEDs negated
pinutils.findpin(pins, "PH0", True)["functions"]["NEGATED"]=0;
pinutils.findpin(pins, "PH1", True)["functions"]["NEGATED"]=0;
pinutils.findpin(pins, "PH2", True)["functions"]["NEGATED"]=0;
pinutils.findpin(pins, "PH3", True)["functions"]["NEGATED"]=0;
pinutils.findpin(pins, "PH4", True)["functions"]["NEGATED"]=0;
# everything is non-5v tolerant
for pin in pins:
pin["functions"]["3.3"]=0;
for pin in pins:
if pin["port"]=="H":
pin["functions"]["NO_BLOCKLY"]=0; # hide in blockly

#The boot/reset button will function as a reset button in normal operation. Pin reset on PD21 needs to be enabled on the nRF52832 device for this to work.
return pins
16 changes: 0 additions & 16 deletions libs/pixljs/jswrap_pixljs.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,22 +472,6 @@ void jswrap_pixljs_init() {
jsvUnLock2(graphics,img);
}

/*JSON{
"type" : "kill",
"generate" : "jswrap_pixljs_kill"
}*/
void jswrap_pixljs_kill() {

}

/*JSON{
"type" : "idle",
"generate" : "jswrap_pixljs_idle"
}*/
bool jswrap_pixljs_idle() {
return false;
}


/*JSON{
"type" : "staticmethod",
Expand Down
2 changes: 0 additions & 2 deletions libs/pixljs/jswrap_pixljs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ void jswrap_pixljs_setContrast(JsVarFloat c);
void jswrap_pixljs_setLCDPower(bool isOn);

void jswrap_pixljs_init();
void jswrap_pixljs_kill();
bool jswrap_pixljs_idle();
JsVarInt jswrap_pixljs_getBattery();
void jswrap_pixljs_powerusage(JsVar *devices);
21 changes: 12 additions & 9 deletions scripts/create_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,36 @@ rm -f bootloader_espruino_$VERSION* espruino_$VERSION*
#rm -rf esp-idf
#rm -rf app
#rm -rf xtensa-esp32-elf
# Install everything
source scripts/provision.sh ALL

# create docs before ESP32 provisioning creates a venv for python which then ensures markdown2 isn't installed
echo Creating Documentation
scripts/build_docs.py || { echo 'Build failed' ; exit 1; }
mv $ESPRUINODIR/functions.html $ZIPDIR/functions.html

# Install everything
source scripts/provision.sh ALL

echo ------------------------------------------------------
echo Building Version $VERSION
echo ------------------------------------------------------
# The following have been removed because it's too hard to keep the build going:
# STM32F3DISCOVERY OLIMEXINO_STM32 HYSTM32_32 HYSTM32_28 HYSTM32_24 RAK8211 RAK8212 RUUVITAG THINGY52 RASPBERRYPI RAK5010
#
for BOARDNAME in ESPRUINO_1V3 ESPRUINO_1V3_AT ESPRUINO_1V3_WIZ PICO_1V3 PICO_1V3_CC3000 PICO_1V3_WIZ ESPRUINOWIFI PUCKJS PUCKJS_MINIMAL PUCKJS_NETWORK PIXLJS JOLTJS BANGLEJS BANGLEJS2 MDBT42Q NUCLEOF401RE NUCLEOF411RE STM32VLDISCOVERY STM32F4DISCOVERY STM32L496GDISCOVERY MICROBIT1 MICROBIT2 ESP8266_BOARD ESP8266_4MB ESP32 SMARTIBOT

for BOARDNAME in ESPRUINO_1V3 ESPRUINO_1V3_AT ESPRUINO_1V3_WIZ PICO_1V3 PICO_1V3_CC3000 PICO_1V3_WIZ ESPRUINOWIFI PUCKJS PUCKJS_MINIMAL PUCKJS_NETWORK PIXLJS PIXLJS_WIZ JOLTJS BANGLEJS BANGLEJS2 MDBT42Q NUCLEOF401RE NUCLEOF411RE STM32VLDISCOVERY STM32F4DISCOVERY STM32L496GDISCOVERY MICROBIT1 MICROBIT2 ESP8266_BOARD ESP8266_4MB ESP32 SMARTIBOT
do
scripts/create_zip_board.sh $BOARDNAME
done



cd $ESPRUINODIR

echo Copying README
sed 's/$/\r/' $ESPRUINODIR/scripts/create_zip_dist_readme.txt | sed "s/#v##/$VERSION/" > $ZIPDIR/readme.txt
cp $ESPRUINODIR/scripts/create_zip_dist_licences.txt $ZIPDIR/licences.txt
echo Copying ChangeLog
bash scripts/extract_changelog.sh | sed 's/$/\r/' > $ZIPDIR/changelog.txt
#bash scripts/extract_todo.sh > $ZIPDIR/todo.txt
scripts/build_docs.py || { echo 'Build failed' ; exit 1; }
mv $ESPRUINODIR/functions.html $ZIPDIR/functions.html
cp $ESPRUINODIR/scripts/create_zip_dist_licences.txt $ZIPDIR/licences.txt

echo Compressing...
rm -f $ZIPFILE
cd zipcontents
echo zip -r $ZIPFILE *
Expand Down
6 changes: 5 additions & 1 deletion scripts/create_zip_board.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ "$#" -ne 1 ]; then
echo ""
echo "Targets are:"
echo "ESPRUINO_1V3 ESPRUINO_1V3_AT ESPRUINO_1V3_WIZ PICO_1V3 PICO_1V3_CC3000 PICO_1V3_WIZ "
echo "ESPRUINOWIFI PUCKJS PUCKJS_MINIMAL PUCKJS_NETWORK PIXLJS BANGLEJS BANGLEJS2 MDBT42Q NUCLEOF401RE NUCLEOF411RE STM32VLDISCOVERY"
echo "ESPRUINOWIFI PUCKJS PUCKJS_MINIMAL PUCKJS_NETWORK PIXLJS PIXLJS_WIZ BANGLEJS BANGLEJS2 MDBT42Q NUCLEOF401RE NUCLEOF411RE STM32VLDISCOVERY"
echo "STM32F4DISCOVERY STM32L496GDISCOVERY MICROBIT2 ESP8266_BOARD ESP8266_4MB ESP32 WIO_LTE RAK5010 SMARTIBOT MICROBIT1"
echo "STM32F3DISCOVERY OLIMEXINO_STM32 HYSTM32_32 HYSTM32_28 HYSTM32_24 RAK8211 RAK8212 RUUVITAG THINGY52 RASPBERRYPI"
exit 255
Expand Down Expand Up @@ -107,6 +107,10 @@ if [ "$BOARDNAME" == "PIXLJS" ]; then
ESP_BINARY_NAME=`basename $ESP_BINARY_NAME .hex`.zip
EXTRADEFS+=DFU_UPDATE_BUILD=1
fi
if [ "$BOARDNAME" == "PIXLJS_WIZ" ]; then
ESP_BINARY_NAME=`basename $ESP_BINARY_NAME .hex`.zip
EXTRADEFS+=DFU_UPDATE_BUILD=1
fi
if [ "$BOARDNAME" == "JOLTJS" ]; then
ESP_BINARY_NAME=`basename $ESP_BINARY_NAME .hex`.zip
EXTRADEFS+=DFU_UPDATE_BUILD=1
Expand Down
4 changes: 4 additions & 0 deletions scripts/create_zip_dist_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ espruino_#v##_pixljs.zip
- The firmware image for Espruino Pixl.js Devices
See http://www.espruino.com/Pixl.js#firmware-updates for more information

espruino_#v##_pixljs_wiznet.zip
- The firmware image for Espruino Pixl.js Devices (with support for WIZnet W5100 Ethernet)
See http://www.espruino.com/Pixl.js#firmware-updates for more information

espruino_#v##_banglejs.zip
- The firmware image for Espruino Bangle.js 1 Devices
See http://www.espruino.com/Bangle.js#firmware-updates for more information
Expand Down

2 comments on commit 9cbae63

@fanoush
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, if you didn't hit any issue with the puckjs nostartfiles optimization
972be5e
it can be added to other nrf52832 boards like PIXLJS too, to save few bytes

@gfwilliams
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll do that!

Please sign in to comment.