mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-28 05:39:00 +08:00
commit
57159dc5c0
@ -3,7 +3,7 @@ CFLAGS += -Wformat-truncation -fno-common -Wconversion -Wno-sign-conversion
|
||||
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
||||
CFLAGS += -I. -Icmsis_core/CMSIS/Core/Include -Icmsis_mcu/devices/MIMXRT1021 #-DCPU_MIMXRT1021DAG5A
|
||||
CFLAGS += -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 $(CFLAGS_EXTRA)
|
||||
LDSCRIPT = link_ram.ld
|
||||
LDSCRIPT = link.ld
|
||||
LDFLAGS ?= -T$(LDSCRIPT) -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--gc-sections -Wl,-Map=$@.map
|
||||
|
||||
SOURCES = main.c syscalls.c sysinit.c
|
||||
@ -11,7 +11,7 @@ SOURCES += cmsis_mcu/devices/MIMXRT1021/gcc/startup_MIMXRT1021.S # NXP startup f
|
||||
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS # Make startup code work as expected
|
||||
|
||||
# Mongoose options are defined in mongoose_custom.h
|
||||
SOURCES += mongoose.c
|
||||
SOURCES += mongoose.c net.c packed_fs.c
|
||||
|
||||
# Example specific build options. See README.md
|
||||
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\" -DHTTPS_URL=\"https://0.0.0.0/\"
|
||||
@ -22,12 +22,11 @@ else
|
||||
RM = rm -rf
|
||||
endif
|
||||
|
||||
all build example update: SOURCES += flash_image.c
|
||||
all build example: firmware.bin
|
||||
|
||||
image: LDSCRIPT = link.ld
|
||||
image: SOURCES += flash_image.c net.c packed_fs.c # no room to run dashboard in RAM w/ default config
|
||||
image: CFLAGS += -DRUNINFLASH
|
||||
image: firmware.bin
|
||||
ram: LDSCRIPT = link_ram.ld
|
||||
ram: firmware.bin
|
||||
|
||||
firmware.bin: firmware.elf
|
||||
arm-none-eabi-objcopy -O binary $< $@
|
||||
@ -37,7 +36,7 @@ firmware.elf: cmsis_core cmsis_mcu $(SOURCES) hal.h link_ram.ld link.ld Makefile
|
||||
arm-none-eabi-size $@
|
||||
|
||||
flash: firmware.bin
|
||||
st-flash --reset write $< 0x8000000
|
||||
# flash
|
||||
|
||||
cmsis_core: # ARM CMSIS core headers
|
||||
git clone -q --depth 1 -b 5.9.0 https://github.com/ARM-software/CMSIS_5 $@
|
||||
@ -57,6 +56,16 @@ endif
|
||||
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/4
|
||||
update: firmware.bin
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @$<
|
||||
|
||||
update updateram: CFLAGS += -DUART_DEBUG=LPUART2
|
||||
|
||||
test: update
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
|
||||
grep 'READY, IP:' /tmp/output.txt # Check for network init
|
||||
|
||||
|
||||
updateram: ram
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @firmware.bin
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"init"}'
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"wm,e000edf0,a05f0003 wm,e000edfc,1 wm,e000ed0c,5fa0004"}'
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"init"}'
|
||||
@ -66,12 +75,10 @@ update: firmware.bin
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"'"$$REQ"'"}'
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"wm,e000edf0,a05f0001"}'
|
||||
|
||||
test update testimage: CFLAGS += -DUART_DEBUG=LPUART2
|
||||
test: update
|
||||
testram: updateram
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
|
||||
grep 'READY, IP:' /tmp/output.txt # Check for network init
|
||||
|
||||
testimage: image
|
||||
|
||||
clean:
|
||||
$(RM) firmware.* *.su cmsis_core cmsis_mcu mbedtls *.zip
|
||||
|
@ -31,31 +31,6 @@ static void timer_fn(void *arg) {
|
||||
ifp->ndrop, ifp->nerr));
|
||||
}
|
||||
|
||||
#ifndef RUNINFLASH
|
||||
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
||||
struct mg_tcpip_if *ifp = (struct mg_tcpip_if *) c->fn_data;
|
||||
if (ev == MG_EV_HTTP_MSG) {
|
||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||
if (mg_http_match_uri(hm, "/api/hello")) { // Request to /api/hello
|
||||
mg_http_reply(c, 200, "", "{%m:%u,%m:%u,%m:%u,%m:%u,%m:%u}\n",
|
||||
MG_ESC("eth"), ifp->state, MG_ESC("frames_received"),
|
||||
ifp->nrecv, MG_ESC("frames_sent"), ifp->nsent,
|
||||
MG_ESC("frames_dropped"), ifp->ndrop,
|
||||
MG_ESC("interface_errors"), ifp->nerr);
|
||||
} else if (mg_http_match_uri(hm, "/")) { // Index page
|
||||
mg_http_reply(
|
||||
c, 200, "", "%s",
|
||||
"<html><head><link rel='icon' href='data:;base64,='></head><body>"
|
||||
"<h1>Welcome to Mongoose</h1>"
|
||||
"See <a href=/api/hello>/api/hello</a> for REST example"
|
||||
"</body></html>");
|
||||
} else { // All other URIs
|
||||
mg_http_reply(c, 404, "", "Not Found\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(void) {
|
||||
gpio_output(LED); // Setup blue LED
|
||||
uart_init(UART_DEBUG, 115200); // Initialise debug printf
|
||||
@ -84,11 +59,7 @@ int main(void) {
|
||||
}
|
||||
|
||||
MG_INFO(("Initialising application..."));
|
||||
#ifdef RUNINFLASH
|
||||
web_init(&mgr);
|
||||
#else
|
||||
mg_http_listen(&mgr, "http://0.0.0.0:80", fn, &mif);
|
||||
#endif
|
||||
|
||||
MG_INFO(("Starting event loop"));
|
||||
for (;;) {
|
||||
|
@ -3,7 +3,8 @@ CFLAGS += -Wformat-truncation -fno-common -Wconversion -Wno-sign-conversion
|
||||
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
||||
CFLAGS += -I. -Icmsis_core/CMSIS/Core/Include -Icmsis_mcu/devices/MIMXRT1021 #-DCPU_MIMXRT1021DAG5A
|
||||
CFLAGS += -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 $(CFLAGS_EXTRA)
|
||||
LDFLAGS ?= -Tlink_ram.ld -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--gc-sections -Wl,-Map=$@.map
|
||||
LDSCRIPT = link.ld
|
||||
LDFLAGS ?= -T$(LDSCRIPT) -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--gc-sections -Wl,-Map=$@.map
|
||||
|
||||
SOURCES = main.c syscalls.c sysinit.c
|
||||
SOURCES += cmsis_mcu/devices/MIMXRT1021/gcc/startup_MIMXRT1021.S # NXP startup file. Compiler-dependent!
|
||||
@ -16,7 +17,7 @@ CFLAGS += -IFreeRTOS-Kernel/include
|
||||
CFLAGS += -IFreeRTOS-Kernel/portable/GCC/ARM_CM4F -Wno-conversion
|
||||
|
||||
# Mongoose options are defined in mongoose_custom.h
|
||||
SOURCES += mongoose.c
|
||||
SOURCES += mongoose.c net.c packed_fs.c
|
||||
|
||||
# Example specific build options. See README.md
|
||||
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"
|
||||
@ -27,19 +28,23 @@ else
|
||||
RM = rm -rf
|
||||
endif
|
||||
|
||||
all build example update: SOURCES += flash_image.c
|
||||
all build example: firmware.bin
|
||||
|
||||
ram: LDSCRIPT = link_ram.ld
|
||||
ram: firmware.bin
|
||||
|
||||
firmware.bin: firmware.elf
|
||||
arm-none-eabi-objcopy -O binary $< $@
|
||||
|
||||
firmware.elf: FreeRTOS-Kernel cmsis_core cmsis_mcu $(SOURCES) hal.h link_ram.ld mongoose_custom.h
|
||||
firmware.elf: FreeRTOS-Kernel cmsis_core cmsis_mcu $(SOURCES) hal.h link_ram.ld link.ld mongoose_custom.h
|
||||
arm-none-eabi-gcc $(SOURCES) $(wildcard FreeRTOS-Kernel/*.c) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
flash: firmware.bin
|
||||
st-flash --reset write $< 0x8000000
|
||||
# flash
|
||||
|
||||
cmsis_core: # ARM CMSIS core headers
|
||||
git clone --depth 1 -b 5.9.0 https://github.com/ARM-software/CMSIS_5 $@
|
||||
cmsis_core: # ARM CMSIS core headers
|
||||
git clone -q --depth 1 -b 5.9.0 https://github.com/ARM-software/CMSIS_5 $@
|
||||
cmsis_mcu:
|
||||
curl -sL https://mcuxpresso.nxp.com/cmsis_pack/repo/NXP.MIMXRT1021_DFP.17.0.0.pack -o $@.zip
|
||||
mkdir $@ && cd $@ && unzip -q ../$@.zip
|
||||
@ -50,6 +55,16 @@ FreeRTOS-Kernel: # FreeRTOS sources
|
||||
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/4
|
||||
update: firmware.bin
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @$<
|
||||
|
||||
update updateram: CFLAGS += -DUART_DEBUG=LPUART2
|
||||
|
||||
test: update
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
|
||||
grep 'READY, IP:' /tmp/output.txt # Check for network init
|
||||
|
||||
|
||||
updateram: ram
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @firmware.bin
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"init"}'
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"wm,e000edf0,a05f0003 wm,e000edfc,1 wm,e000ed0c,5fa0004"}'
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"init"}'
|
||||
@ -59,11 +74,10 @@ update: firmware.bin
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"'"$$REQ"'"}'
|
||||
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/rpc/swd.exec -d '{"req":"wm,e000edf0,a05f0001"}'
|
||||
|
||||
test update: CFLAGS += -DUART_DEBUG=LPUART2
|
||||
test: update
|
||||
testram: updateram
|
||||
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
|
||||
grep 'READY, IP:' /tmp/output.txt # Check for network init
|
||||
# grep 'MQTT connected' /tmp/output.txt # Check for MQTT connection success
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) firmware.* *.su cmsis_core cmsis_mcu FreeRTOS-Kernel *.zip
|
||||
|
1
examples/nxp/rt1020-evk-make-freertos-builtin/dcd.h
Symbolic link
1
examples/nxp/rt1020-evk-make-freertos-builtin/dcd.h
Symbolic link
@ -0,0 +1 @@
|
||||
../rt1020-evk-make-baremetal-builtin/dcd.h
|
1
examples/nxp/rt1020-evk-make-freertos-builtin/flash_image.c
Symbolic link
1
examples/nxp/rt1020-evk-make-freertos-builtin/flash_image.c
Symbolic link
@ -0,0 +1 @@
|
||||
../rt1020-evk-make-baremetal-builtin/flash_image.c
|
1
examples/nxp/rt1020-evk-make-freertos-builtin/flexspi.h
Symbolic link
1
examples/nxp/rt1020-evk-make-freertos-builtin/flexspi.h
Symbolic link
@ -0,0 +1 @@
|
||||
../rt1020-evk-make-baremetal-builtin/flexspi.h
|
@ -301,3 +301,37 @@ static inline void ethernet_init(void) {
|
||||
((OCOTP->CFG0 >> 19) ^ (OCOTP->CFG1 >> 19)) & 255, \
|
||||
(OCOTP->CFG1 >> 10) & 255, OCOTP->CFG1 & 255 \
|
||||
}
|
||||
|
||||
static inline void flash_init(void) { // QSPI in FlexSPI
|
||||
// set pins
|
||||
clock_periph(4, CCM_CCGR4_CG1_SHIFT, CLOCK_ON_RUN_WAIT); // iomuxc_ipg_clk_s
|
||||
gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_05, 1); // set for DQS
|
||||
IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_05] |= IOMUXC_SW_MUX_CTL_PAD_SION(1); // loop signal back from pin
|
||||
gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B1_05, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, GPIO_PULL_NONE);
|
||||
gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_11, 1); // set for SS
|
||||
IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_11] |= IOMUXC_SW_MUX_CTL_PAD_SION(1); // loop signal back from pin
|
||||
gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B1_11, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, GPIO_PULL_NONE);
|
||||
gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_07, 1); // set for SCLK
|
||||
IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_07] |= IOMUXC_SW_MUX_CTL_PAD_SION(1); // loop signal back from pin
|
||||
periph_mux_config(kIOMUXC_FLEXSPI_A_SCLK_SELECT_INPUT, 0); // drive peripheral from B1_07
|
||||
gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B1_07, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, GPIO_PULL_NONE);
|
||||
gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_08, 1); // set for DATA0
|
||||
IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_08] |= IOMUXC_SW_MUX_CTL_PAD_SION(1); // loop signal back from pin
|
||||
periph_mux_config(kIOMUXC_FLEXSPI_A_DATA0_SELECT_INPUT, 0); // drive peripheral from B1_08
|
||||
gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B1_08, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, GPIO_PULL_NONE);
|
||||
gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_10, 1); // set for DATA1
|
||||
IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_10] |= IOMUXC_SW_MUX_CTL_PAD_SION(1); // loop signal back from pin
|
||||
periph_mux_config(kIOMUXC_FLEXSPI_A_DATA1_SELECT_INPUT, 0); // drive peripheral from B1_10
|
||||
gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B1_10, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, GPIO_PULL_NONE);
|
||||
gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_09, 1); // set for DATA2
|
||||
IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_09] |= IOMUXC_SW_MUX_CTL_PAD_SION(1); // loop signal back from pin
|
||||
periph_mux_config(kIOMUXC_FLEXSPI_A_DATA2_SELECT_INPUT, 0); // drive peripheral from B1_09
|
||||
gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B1_09, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, GPIO_PULL_NONE);
|
||||
gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_06, 1); // set for DATA3
|
||||
IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B1_06] |= IOMUXC_SW_MUX_CTL_PAD_SION(1); // loop signal back from pin
|
||||
periph_mux_config(kIOMUXC_FLEXSPI_A_DATA3_SELECT_INPUT, 0); // drive peripheral from B1_06
|
||||
gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B1_06, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, GPIO_PULL_NONE);
|
||||
// set FlexSPI clock
|
||||
SETBITS(CCM->CSCMR1, CCM_CSCMR1_FLEXSPI_CLK_SEL_MASK | CCM_CSCMR1_FLEXSPI_PODF_MASK, CCM_CSCMR1_FLEXSPI_CLK_SEL(3) | CCM_CSCMR1_FLEXSPI_PODF(3)); // select PLL3 PFD0 /4
|
||||
clock_periph(6, CCM_CCGR6_CG5_SHIFT, CLOCK_ON_RUN_WAIT); // enable
|
||||
}
|
||||
|
22
examples/nxp/rt1020-evk-make-freertos-builtin/link.ld
Normal file
22
examples/nxp/rt1020-evk-make-freertos-builtin/link.ld
Normal file
@ -0,0 +1,22 @@
|
||||
ENTRY(Reset_Handler);
|
||||
MEMORY {
|
||||
flash_hdr(rx) : ORIGIN = 0x60000000, LENGTH = 8k
|
||||
flash_irq(rx) : ORIGIN = 0x60002000, LENGTH = 1k
|
||||
flash_code(rx) : ORIGIN = 0x60002400, LENGTH = 8183k
|
||||
|
||||
itcram(rx) : ORIGIN = 0x00000000, LENGTH = 64k
|
||||
dtcram(rw) : ORIGIN = 0x20000000, LENGTH = 64k
|
||||
ocram(rw) : ORIGIN = 0x20200000, LENGTH = 128k
|
||||
}
|
||||
__StackTop = ORIGIN(dtcram) + LENGTH(dtcram);
|
||||
|
||||
SECTIONS {
|
||||
.hdr : { FILL(0xff) ; KEEP(*(.cfg)) . = 0x1000 ; KEEP(*(.ivt)) . = 0x1020 ;
|
||||
KEEP(*(.dat)) . = 0x1030 ; KEEP(*(.dcd)) . = 0x2000 ;} >flash_hdr
|
||||
.irq : { KEEP(*(.isr_vector)) } > flash_irq
|
||||
.text : { *(.text* .text.*) *(.rodata*) ; } > flash_code
|
||||
.data : { __data_start__ = .; *(.data SORT(.data.*)) __data_end__ = .; } > dtcram AT > flash_code
|
||||
__etext = LOADADDR(.data);
|
||||
.bss : { __bss_start__ = .; *(.bss SORT(.bss.*) COMMON) __bss_end__ = .; } > dtcram
|
||||
_end = .;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "hal.h"
|
||||
#include "mongoose.h"
|
||||
#include "net.h"
|
||||
|
||||
#define BLINK_PERIOD_MS 1000 // LED blinking period in millis
|
||||
|
||||
@ -21,29 +22,6 @@ static void timer_fn(void *arg) {
|
||||
ifp->ndrop, ifp->nerr));
|
||||
}
|
||||
|
||||
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
||||
struct mg_tcpip_if *ifp = (struct mg_tcpip_if *) c->fn_data;
|
||||
if (ev == MG_EV_HTTP_MSG) {
|
||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||
if (mg_http_match_uri(hm, "/api/hello")) { // Request to /api/hello
|
||||
mg_http_reply(c, 200, "", "{%m:%u,%m:%u,%m:%u,%m:%u,%m:%u}\n",
|
||||
MG_ESC("eth"), ifp->state, MG_ESC("frames_received"),
|
||||
ifp->nrecv, MG_ESC("frames_sent"), ifp->nsent,
|
||||
MG_ESC("frames_dropped"), ifp->ndrop,
|
||||
MG_ESC("interface_errors"), ifp->nerr);
|
||||
} else if (mg_http_match_uri(hm, "/")) { // Index page
|
||||
mg_http_reply(
|
||||
c, 200, "", "%s",
|
||||
"<html><head><link rel='icon' href='data:;base64,='></head><body>"
|
||||
"<h1>Welcome to Mongoose</h1>"
|
||||
"See <a href=/api/hello>/api/hello</a> for REST example"
|
||||
"</body></html>");
|
||||
} else { // All other URIs
|
||||
mg_http_reply(c, 404, "", "Not Found\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void server(void *args) {
|
||||
struct mg_mgr mgr; // Initialise Mongoose event manager
|
||||
mg_mgr_init(&mgr); // and attach it to the interface
|
||||
@ -68,7 +46,7 @@ static void server(void *args) {
|
||||
}
|
||||
|
||||
MG_INFO(("Initialising application..."));
|
||||
mg_http_listen(&mgr, "http://0.0.0.0:80", fn, &mif);
|
||||
web_init(&mgr);
|
||||
|
||||
MG_INFO(("Starting event loop"));
|
||||
for (;;) mg_mgr_poll(&mgr, 1); // Infinite event loop
|
||||
|
1
examples/nxp/rt1020-evk-make-freertos-builtin/net.c
Symbolic link
1
examples/nxp/rt1020-evk-make-freertos-builtin/net.c
Symbolic link
@ -0,0 +1 @@
|
||||
../../device-dashboard/net.c
|
1
examples/nxp/rt1020-evk-make-freertos-builtin/net.h
Symbolic link
1
examples/nxp/rt1020-evk-make-freertos-builtin/net.h
Symbolic link
@ -0,0 +1 @@
|
||||
../../device-dashboard/net.h
|
1
examples/nxp/rt1020-evk-make-freertos-builtin/packed_fs.c
Symbolic link
1
examples/nxp/rt1020-evk-make-freertos-builtin/packed_fs.c
Symbolic link
@ -0,0 +1 @@
|
||||
../../device-dashboard/packed_fs.c
|
@ -69,38 +69,14 @@ void SystemInit(void) { // Called automatically by startup code (ints masked)
|
||||
CCM_CBCMR_PRE_PERIPH_CLK_SEL(3)); // run from 500MHz clock
|
||||
// 14.5 Table 14-4: uart_clk_root
|
||||
// 14.4: uart_clk_root = PLL3/6 or OSC; CCM_CSCDR1 (14.7.9) defaults to
|
||||
// PLL3/6/1
|
||||
// PLL3/6/1; but ROM boot code fiddles with the divider (9.5.3 Table 9-7)
|
||||
CCM_ANALOG->PLL_USB1 |= CCM_ANALOG_PLL_USB1_POWER_MASK; // Power PLL on
|
||||
while ((CCM_ANALOG->PLL_USB1 & CCM_ANALOG_PLL_USB1_LOCK_MASK) == 0)
|
||||
spin(1); // wait until it is stable
|
||||
CCM_ANALOG->PLL_USB1 &=
|
||||
~CCM_ANALOG_PLL_USB1_BYPASS_MASK; // Disable Bypass (switch to PLL)
|
||||
CCM->CSCDR1 &= ~(CCM_CSCDR1_UART_CLK_SEL_MASK | CCM_CSCDR1_UART_CLK_PODF_MASK);
|
||||
rng_init(); // Initialise random number generator
|
||||
// NXP startup code calls SystemInit BEFORE initializing RAM...
|
||||
SysTick_Config(SYS_FREQUENCY / 1000); // Sys tick every 1ms
|
||||
}
|
||||
|
||||
#if 0
|
||||
__attribute__((section(".cfg"), used)) uint32_t __cfg[] = {0x1234abcd};
|
||||
|
||||
extern uint32_t __isr_vector[];
|
||||
extern uint32_t __ivt_boot_data[];
|
||||
|
||||
__attribute__((section(".ivt"), used)) uint32_t __ivt[8] = {
|
||||
0x412000d1, // header: 41 - version, 2000 size, d1 tag
|
||||
(uint32_t) __isr_vector, // entry
|
||||
0, // reserved
|
||||
0, // dcd
|
||||
(uint32_t) __ivt_boot_data, // boot data
|
||||
(uint32_t) __ivt, // this is us - ivt absolute address
|
||||
0, // csf absolute address
|
||||
0, // reserved for HAB
|
||||
};
|
||||
|
||||
__attribute__((section(".ivt"), used)) uint32_t __ivt_boot_data[] = {
|
||||
0, // boot start location
|
||||
64 * 1024, // size
|
||||
0, // Plugin flag
|
||||
0Xffffffff // empty - extra data word
|
||||
};
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user