Update downloads

This commit is contained in:
cpq committed 2026-05-12 13:29:04 +01:00
1 parent e56f6987f4
commit 7ab79669ef
3 files changed
+35 -31

No files matched your search

+11 -9
View File
@@ -5,15 +5,14 @@ PROJECTS = full minimal
TARGETS = desktop $(ST_TARGETS) TARGETS = desktop $(ST_TARGETS)
MX ?= /Applications/STMicroelectronics/STM32CubeMX.app/Contents/MacOs/STM32CubeMX MX ?= /Applications/STMicroelectronics/STM32CubeMX.app/Contents/MacOs/STM32CubeMX
DIRS = $(foreach P,$(PROJECTS),$(foreach T,$(TARGETS),$(T)_$(P))) DIRS = $(foreach P,$(PROJECTS),$(foreach T,$(TARGETS),$(T)_dashboard_$(P)))
ZIPS = $(foreach D,$(DIRS),$(D).zip) ZIPS = $(foreach D,$(DIRS),$(D).zip)
all: $(ZIPS) all: $(ZIPS)
DESKTOP_DIRS = $(foreach P,$(PROJECTS),desktop_$(P)) DESKTOP_DIRS = $(foreach P,$(PROJECTS),desktop_dashboard_$(P))
#H723_DIRS = $(foreach P,$(PROJECTS),h723_$(P))
$(DESKTOP_DIRS): desktop_%: $(DESKTOP_DIRS): desktop_dashboard_%:
mkdir -p $@ $@/resources mkdir -p $@ $@/resources
$(MAKE) -C $(TOP)/tutorials/device-dashboard/$* clean $(MAKE) -C $(TOP)/tutorials/device-dashboard/$* clean
cp $(TOP)/tutorials/device-dashboard/$*/*{c,html,Makefile} $@ cp $(TOP)/tutorials/device-dashboard/$*/*{c,html,Makefile} $@
@@ -22,17 +21,20 @@ $(DESKTOP_DIRS): desktop_%:
cp $(TOP)/resources/*.js $@/resources cp $(TOP)/resources/*.js $@/resources
sed -i "" "s,../../..,.," $@/Makefile sed -i "" "s,../../..,.," $@/Makefile
define ST_RULE define ST_MONGOOSE_RULE
$(1): $(1).ioc # This creates MX-generated baseline project $(1)_mongoose: $(1).ioc
mkdir -p $$@ mkdir -p $$@
cp $(1).ioc $$@ cp $(1).ioc $$@
sh init.sh $(1) sh init.sh $(1)
endef
$(1)_$(2): $(1) define ST_DASHBOARD_RULE
$(1)_dashboard_$(2): $(1)_mongoose
sh init.sh $(1) $(2) sh init.sh $(1) $(2)
endef endef
$(foreach T,$(ST_TARGETS), $(foreach P,$(PROJECTS), $(eval $(call ST_RULE,$(T),$(P))))) $(foreach T,$(ST_TARGETS), $(eval $(call ST_MONGOOSE_RULE,$(T))))
$(foreach T,$(ST_TARGETS), $(foreach P,$(PROJECTS), $(eval $(call ST_DASHBOARD_RULE,$(T),$(P)))))
%.zip: % %.zip: %
zip -qr $@ $< zip -qr $@ $<
@@ -41,4 +43,4 @@ upload: $(ZIPS)
scp $(ZIPS) h1:/data/downloads/ scp $(ZIPS) h1:/data/downloads/
clean: clean:
rm -rf $(DIRS) $(ST_TARGETS) $(ZIPS) gen.mx rm -rf $(DIRS) $(ZIPS) $(foreach T,$(ST_TARGETS),$(T)_mongoose)
+18 -16
View File
@@ -24,35 +24,37 @@ if test -z "$BOARD" ; then
fi fi
# Create project directory # Create project directory
mkdir -p $BOARD DIR=${BOARD}_mongoose
test -f "$BOARD/$BOARD.ioc" || $CURL $RAW/resources/downloads/$BOARD.ioc -o $BOARD/$BOARD.ioc 2>/dev/null DIR2=${BOARD}_dashboard_${DASH}
test -f "$BOARD/$BOARD.ioc" || fail echo "Usupported board $BOARD" test -d $DIR || mkdir -p $DIR
test -f "$DIR/$BOARD.ioc" || $CURL $RAW/resources/downloads/$BOARD.ioc -o $DIR/$BOARD.ioc 2>/dev/null
test -f "$DIR/$BOARD.ioc" || fail echo "Usupported board $BOARD"
# Run CubeMX to generate project using a pre-configured .ioc file # Run CubeMX to generate project using a pre-configured .ioc file
echo config load `pwd`/$BOARD/$BOARD.ioc > gen.mx echo config load `pwd`/$DIR/$BOARD.ioc > gen.mx
echo project generate >> gen.mx echo project generate >> gen.mx
echo exit >> gen.mx echo exit >> gen.mx
test -f "$BOARD/CMakeLists.txt" || $MX -q `pwd`/gen.mx test -f "$DIR/CMakeLists.txt" || $MX -q `pwd`/gen.mx
# Adopt generated code for Mongoose # Adopt generated code for Mongoose
MAIN_C=$BOARD/Core/Src/main.c MAIN_C=$DIR/Core/Src/main.c
grep -q mongoose.h $MAIN_C || perl -i -ne 'print; print "#include \"mongoose.h\"\n" if /BEGIN Includes/' $MAIN_C grep -q mongoose.h $MAIN_C || perl -i -ne 'print; print "#include \"mongoose.h\"\n" if /BEGIN Includes/' $MAIN_C
grep -q '^int _write' $MAIN_C || perl -i -ne 'print; print "int _write(int fd, unsigned char *buf, int len) {\n HAL_UART_Transmit(&huart3, buf, len, HAL_MAX_DELAY);\n return len;\n}\n" if /USER CODE BEGIN 0/' $MAIN_C grep -q '^int _write' $MAIN_C || perl -i -ne 'print; print "int _write(int fd, unsigned char *buf, int len) {\n HAL_UART_Transmit(&huart3, buf, len, HAL_MAX_DELAY);\n return len;\n}\n" if /USER CODE BEGIN 0/' $MAIN_C
grep -q 'mg_mgr_init' $MAIN_C || perl -i -ne 'print; print " struct mg_mgr mgr;\n mg_mgr_init(&mgr);\n\n" if /USER CODE BEGIN WHILE/' $MAIN_C grep -q 'mg_mgr_init' $MAIN_C || perl -i -ne 'print; print " struct mg_mgr mgr;\n mg_mgr_init(&mgr);\n\n" if /USER CODE BEGIN WHILE/' $MAIN_C
grep -q 'mg_mgr_poll' $MAIN_C || perl -i -ne 'print " mg_mgr_poll(&mgr, 0);\n" if /USER CODE END WHILE/; print;' $MAIN_C grep -q 'mg_mgr_poll' $MAIN_C || perl -i -ne 'print " mg_mgr_poll(&mgr, 0);\n" if /USER CODE END WHILE/; print;' $MAIN_C
test -f $BOARD/STM32H723XG_FLASH.ld && (grep -q eth_ram $BOARD/STM32H723XG_FLASH.ld || perl -i -ne 'print ; print "\n /* Mongoose Ethernet driver */\n .eth_ram : { *(.eth_ram .eth_ram*) } > RAM_D2 AT > FLASH\n" if /_sidata =/' $BOARD/STM32H723XG_FLASH.ld) test -f $DIR/STM32H723XG_FLASH.ld && (grep -q eth_ram $DIR/STM32H723XG_FLASH.ld || perl -i -ne 'print ; print "\n /* Mongoose Ethernet driver */\n .eth_ram : { *(.eth_ram .eth_ram*) } > RAM_D2 AT > FLASH\n" if /_sidata =/' $DIR/STM32H723XG_FLASH.ld)
test -f $BOARD/LICENSE || $CURL $RAW/LICENSE -o $BOARD/LICENSE test -f $DIR/LICENSE || $CURL $RAW/LICENSE -o $DIR/LICENSE
# If dashboard is specified, copy it to the project # If dashboard is specified, copy it to the project
if test "$DASH" == "full" -o "$DASH" == "minimal" ; then if test "$DASH" == "full" -o "$DASH" == "minimal" ; then
test -d ${BOARD}_${DASH} || cp -r $BOARD ${BOARD}_${DASH} test -d $DIR2 || cp -r $DIR $DIR2
test -d ${BOARD}_${DASH}/Mongoose || mkdir -p ${BOARD}_${DASH}/Mongoose test -d $DIR2/Mongoose || mkdir -p $DIR2/Mongoose
test -f ${BOARD}_${DASH}/Mongoose/dashboard.c || $CURL $RAW/tutorials/device-dashboard/$DASH/dashboard.c -o ${BOARD}_${DASH}/Mongoose/dashboard.c test -f $DIR2/Mongoose/dashboard.c || $CURL $RAW/tutorials/device-dashboard/$DASH/dashboard.c -o $DIR2/Mongoose/dashboard.c
test -f ${BOARD}_${DASH}/Mongoose/dashboard.html || $CURL $RAW/tutorials/device-dashboard/$DASH/dashboard.html -o ${BOARD}_${DASH}/Mongoose/dashboard.html test -f $DIR2/Mongoose/dashboard.html || $CURL $RAW/tutorials/device-dashboard/$DASH/dashboard.html -o $DIR2/Mongoose/dashboard.html
test -f ${BOARD}_${DASH}/Mongoose/html2c.js || $CURL $RAW/resources/html2c.js -o ${BOARD}_${DASH}/Mongoose/html2c.js test -f $DIR2/Mongoose/html2c.js || $CURL $RAW/resources/html2c.js -o $DIR2/Mongoose/html2c.js
MAIN2_C=${BOARD}_${DASH}/Core/Src/main.c MAIN2_C=$DIR2/Core/Src/main.c
grep -q 'mg_dash_init' $MAIN2_C || perl -i -ne 'print; print " mg_dash_init(&mgr);\n" if /mg_mgr_init/' $MAIN2_C grep -q 'mg_dash_init' $MAIN2_C || perl -i -ne 'print; print " mg_dash_init(&mgr);\n" if /mg_mgr_init/' $MAIN2_C
grep -q 'mg_dash_poll' $MAIN2_C || perl -i -ne 'print; print " mg_dash_poll(&mgr);\n" if /mg_mgr_poll/' $MAIN2_C grep -q 'mg_dash_poll' $MAIN2_C || perl -i -ne 'print; print " mg_dash_poll(&mgr);\n" if /mg_mgr_poll/' $MAIN2_C
grep -q '^ Mongoose/file_data.c' ${BOARD}_${DASH}/CMakeLists.txt || perl -i -ne 'print; print " Mongoose/dashboard.c\n Mongoose/file_data.c\n" if /# Add user sources here/' ${BOARD}_${DASH}/CMakeLists.txt grep -q '^ Mongoose/file_data.c' $DIR2/CMakeLists.txt || perl -i -ne 'print; print " Mongoose/dashboard.c\n Mongoose/file_data.c\n" if /# Add user sources here/' $DIR2/CMakeLists.txt
grep -q 'html2c.js' ${BOARD}_${DASH}/CMakeLists.txt || perl -i -ne 'print "# Generate file_data.c from dashboard.html\nadd_custom_command(\n OUTPUT \${CMAKE_SOURCE_DIR}/Mongoose/file_data.c\n COMMAND node \${CMAKE_SOURCE_DIR}/Mongoose/html2c.js \${CMAKE_SOURCE_DIR}/Mongoose/dashboard.html -o \${CMAKE_SOURCE_DIR}/Mongoose/file_data.c\n DEPENDS \${CMAKE_SOURCE_DIR}/Mongoose/dashboard.html\n VERBATIM\n)\n\n" if /^# Add sources to executable/; print;' ${BOARD}_${DASH}/CMakeLists.txt grep -q 'html2c.js' $DIR2/CMakeLists.txt || perl -i -ne 'print "# Generate file_data.c from dashboard.html\nadd_custom_command(\n OUTPUT \${CMAKE_SOURCE_DIR}/Mongoose/file_data.c\n COMMAND node \${CMAKE_SOURCE_DIR}/Mongoose/html2c.js \${CMAKE_SOURCE_DIR}/Mongoose/dashboard.html -o \${CMAKE_SOURCE_DIR}/Mongoose/file_data.c\n DEPENDS \${CMAKE_SOURCE_DIR}/Mongoose/dashboard.html\n VERBATIM\n)\n\n" if /^# Add sources to executable/; print;' $DIR2/CMakeLists.txt
fi fi
@@ -40,19 +40,19 @@
<div>LED ${status.led1 ? 'ON' : 'OFF'}</div> <div>LED ${status.led1 ? 'ON' : 'OFF'}</div>
</section> </section>
<div style="max-width: 40em; color: #075985; background: #e0f2fe; border: 1px solid #7dd3fc; border-radius: 0.5rem; padding: 0.75rem 0.9rem; font-size: 0.86rem; line-height: 1.55; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75); display: flex; flex-direction: column; gap: 0.5rem; "> <div style="max-width: 45em; color: #075985; background: #e0f2fe; border: 1px solid #7dd3fc; border-radius: 0.5rem; padding: 0.75rem 0.9rem; font-size: 0.86rem; line-height: 1.55; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75); display: flex; flex-direction: column; gap: 0.5rem; ">
<div> <div>
This toggle button is a stylised checkbox. This toggle button is a stylised checkbox.
<code>data-bind="status.led1"</code> binds it to the device variable. <code>data-bind="status.led1"</code> binds it to the device variable.
<code>data-autosave="1"</code> makes it send POST /api/status <code>data-autosave="1"</code> makes it send <code>{"led1": VALUE}</code> to the device every time the user toggles the
<code>{"led1": VALUE}</code> to the device every time the user toggles the button. On the device side, <code>read_status()</code> or <code>write_status()</code> are called every time
button. On the device side, <code>sync_status()</code> is called every time
the LED state is read or written. the LED state is read or written.
</div> </div>
<div style="text-align: left; margin-top: 6px;"> <div style="text-align: left; margin-top: 6px;">
Open this page in two or more browser windows and see how the dashboards Open this page in two or more browser windows to see how
stay synchronised when changes are made in any of them. the dashboards stay synchronized when changes are made
in any of them.
</div> </div>
<div style="text-align: left; margin-top: 6px;"> <div style="text-align: left; margin-top: 6px;">