Skip to content

Commit

Permalink
RT1020 and RT1060 OTA
Browse files Browse the repository at this point in the history
  • Loading branch information
robert committed Jan 16, 2024
1 parent 0ad4002 commit 29d9588
Show file tree
Hide file tree
Showing 15 changed files with 752 additions and 267 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,12 @@ mongoose.c: Makefile $(wildcard src/*.c) $(wildcard src/drivers/*.c)
(cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/*.c src/drivers/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@

mongoose.h: $(HDRS) Makefile
(cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/net_ft.h src/net_lwip.h src/net_rl.h src/config.h src/str.h src/queue.h src/fmt.h src/printf.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/sha256.h src/tls_aes128.h src/tls_uecc.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h src/ota.h src/device.h src/net_builtin.h src/profile.h src/drivers/*.h | sed -e '/keep/! s,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@
(cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/net_ft.h src/net_lwip.h src/net_rl.h src/config.h src/str.h src/queue.h src/fmt.h src/printf.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/sha256.h src/tls_aes128.h src/tls_uecc.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h src/ota.h src/device.h src/device_imxrt_flexspi.h src/net_builtin.h src/profile.h src/drivers/*.h | sed -e '/keep/! s,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@


clean: clean_examples clean_embedded
rm -rf $(PROG) *.exe *.o *.dSYM *_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack
#find examples -maxdepth 3 -name zephyr -prune -o -name Makefile -print | xargs dirname | xargs -n1 make clean -C

clean_embedded:
for X in $(EXAMPLES_EMBEDDED); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done

for X in $(EXAMPLES_EMBEDDED); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done
10 changes: 5 additions & 5 deletions examples/nxp/rt1020-evk-make-baremetal-builtin/flash_image.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "dcd.h" // pin settings for MIMXRT1020-EVK board
#include "flexspi.h" // peripheral structures
#include "mongoose.h"
#include "hal.h"

extern uint32_t __isr_vector[];
Expand Down Expand Up @@ -29,9 +29,9 @@ __attribute__((section(".ivt"), used)) const uint32_t __ivt[8] = {

// MIMXRT1060-EVKB flash chip config: S25LP064A-JBLE
__attribute__((section(".cfg"), used))
const flexspi_nor_config_t __qspi_flash_cfg = {
.memConfig = {.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
const struct mg_flexspi_nor_config __qspi_flash_cfg = {
.memConfig = {.tag = MG_FLEXSPI_CFG_BLK_TAG,
.version = MG_FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = 1, // ReadSampleClk_LoopbackFromDqsPad
.csHoldTime = 3,
.csSetupTime = 3,
Expand All @@ -40,7 +40,7 @@ const flexspi_nor_config_t __qspi_flash_cfg = {
.sflashPadType = 4,
.serialClkFreq = 7, // 133MHz
.sflashA1Size = 8 * 1024 * 1024,
.lookupTable = __FLEXSPI_QSPI_LUT},
.lookupTable = MG_FLEXSPI_QSPI_LUT},
.pageSize = 256,
.sectorSize = 4 * 1024,
.ipcmdSerialClkFreq = 1,
Expand Down
122 changes: 0 additions & 122 deletions examples/nxp/rt1020-evk-make-baremetal-builtin/flexspi.h

This file was deleted.

8 changes: 5 additions & 3 deletions examples/nxp/rt1020-evk-make-baremetal-builtin/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ 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
flash_code(rx) : ORIGIN = 0x60002400, LENGTH = 8179k

itcram(rx) : ORIGIN = 0x00000000, LENGTH = 64k
dtcram(rw) : ORIGIN = 0x20000000, LENGTH = 64k
ocram(rw) : ORIGIN = 0x20200000, LENGTH = 128k
}
__StackTop = ORIGIN(dtcram) + LENGTH(dtcram);

/* TODO(): separate itcram and go back to using dtcram for data and bss when ota is finished */

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
.data : { __data_start__ = .; *(.data SORT(.data.*)) *(.iram) __data_end__ = .; } > itcram AT > flash_code
__etext = LOADADDR(.data);
.bss : { __bss_start__ = .; *(.bss SORT(.bss.*) COMMON) __bss_end__ = .; } > dtcram
.bss : { __bss_start__ = .; *(.bss SORT(.bss.*) COMMON) __bss_end__ = .; } > itcram
_end = .;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

// See https://mongoose.ws/documentation/#build-options
#define MG_ARCH MG_ARCH_NEWLIB
#define MG_OTA MG_OTA_FLASH
#define MG_DEVICE MG_DEVICE_RT1020

#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_IMXRT 1
Expand Down
10 changes: 5 additions & 5 deletions examples/nxp/rt1060-evk-make-baremetal-builtin/flash_image.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "dcd.h" // pin settings for MIMXRT1060-EVKB board
#include "flexspi.h" // peripheral structures
#include "mongoose.h"
#include "hal.h"

extern uint32_t __isr_vector[];
Expand Down Expand Up @@ -29,9 +29,9 @@ __attribute__((section(".ivt"), used)) const uint32_t __ivt[8] = {

// MIMXRT1060-EVKB flash chip config: IS25WP064AJBLE
__attribute__((section(".cfg"), used))
const flexspi_nor_config_t __qspi_flash_cfg = {
.memConfig = {.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
const struct mg_flexspi_nor_config __qspi_flash_cfg = {
.memConfig = {.tag = MG_FLEXSPI_CFG_BLK_TAG,
.version = MG_FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = 1, // ReadSampleClk_LoopbackFromDqsPad
.csHoldTime = 3,
.csSetupTime = 3,
Expand All @@ -40,7 +40,7 @@ const flexspi_nor_config_t __qspi_flash_cfg = {
.sflashPadType = 4,
.serialClkFreq = 7, // 120MHz
.sflashA1Size = 8 * 1024 * 1024,
.lookupTable = __FLEXSPI_QSPI_LUT},
.lookupTable = MG_FLEXSPI_QSPI_LUT},
.pageSize = 256,
.sectorSize = 4 * 1024,
.ipcmdSerialClkFreq = 1,
Expand Down
Loading

0 comments on commit 29d9588

Please sign in to comment.