diff --git a/_targets/armv7m7/imxrt105x/build.project b/_targets/armv7m7/imxrt105x/build.project index 87c8c7c2..992c00a3 100644 --- a/_targets/armv7m7/imxrt105x/build.project +++ b/_targets/armv7m7/imxrt105x/build.project @@ -36,63 +36,22 @@ export PORTS_AZURE_SDK=n # # Platform dependent parameters # -SIZE_PAGE=$((0x200)) -PAGE_MASK=$((0xfffffe00)) +export SIZE_PAGE=$((0x200)) # # Project specific build # -BOOT_DEVICE="flash0" -NAME_USER_SCRIPT="user.plo" -OFFS_USER_SCRIPT=$((0x11000)) -MAGIC_USER_SCRIPT=$((0xdabaabad)) -KERNEL_OFFS=$((0x12000)) +export BOOT_DEVICE="flash0" +export MAGIC_USER_SCRIPT=dabaabad # Physical kernel address KERNEL_PHBASE=$((0x0)) # itcm start address KERNEL_PHOFFS=$((0x0)) -export KERNEL_PHADDR=$(printf "%08x" $((KERNEL_PHBASE + KERNEL_PHOFFS))) +KERNEL_PHADDR=$(printf "%08x" $((KERNEL_PHBASE + KERNEL_PHOFFS))) +export KERNEL_PHADDR -# All data/code maps need to be cacheable to allow unaligned accesses - -# Pre-init script is launched before user script -PREINIT_SCRIPT=( - "map itcm 0x0 0x28000 rwxcb" - "map dtcm 0x20000000 0x20048000 rwcb" - "map ocram 0x20200000 0x20220000 rwxcb" - "map xip1 0x60000000 0x60800000 rxcb" - "map io 0x40000000 0x50000000 rw" - "phfs usb0 1.2 phoenixd" - "phfs flash0 2.0 raw" - "console 0.0") - - -# Production user script contains applications to run Phoenix-RTOS -USER_SCRIPT=( - "kernel ${BOOT_DEVICE}" - "app ${BOOT_DEVICE} -x dummyfs xip1 dtcm" - "app ${BOOT_DEVICE} -x imxrt-multi xip1 dtcm;io" - "app ${BOOT_DEVICE} -x psh xip1 dtcm" - "wait 2000" - "go!") - - -# Example of user dev script which call remotely script -DEV_USER_SCRIPT=( - "echo on" - "wait 3000" - "call usb0 script-${TARGET_FAMILY}-${TARGET_SUBFAMILY}-dev.plo 5a5aa5a5") - - -REMOTE_USER_SCRIPT=( - "5a5aa5a5" - "kernel usb0" - "app usb0 -x dummyfs ocram dtcm" - "app usb0 -x imxrt-multi itcm ocram" - "app usb0 -x psh ocram dtcm" - "go!") b_build_project() { @@ -105,7 +64,8 @@ b_build_target() { b_log "Building $TARGET project" b_log "Building phoenix-rtos-loader" - b_mkscript_preinit + image_builder.py script --nvm "$NVM_CONFIG" --script "$PLO_SCRIPT_PREINIT" --out script.plo + RAM_SCRIPT=1 image_builder.py script --nvm "$NVM_CONFIG" --script "$PLO_SCRIPT_PREINIT" --out script-ram.plo make -C plo all @@ -115,13 +75,8 @@ b_build_target() { b_image_target() { - b_mkscript_user "${USER_SCRIPT[@]}" - b_prod_image - - # TODO: Fix b_dev_image overwriting user.plo created by b_prod_image - cp "$PLO_SCRIPT_DIR/$NAME_USER_SCRIPT" "${PREFIX_BOOT}" - - b_dev_image + image_builder.py -v partition --nvm "$NVM_CONFIG" --name user --script "$PLO_SCRIPT_USER" + image_builder.py -v disk --nvm "$NVM_CONFIG" --part "plo=${PREFIX_PROG_STRIPPED}plo-${TARGET_FAMILY}-${TARGET_SUBFAMILY}.img" --out "phoenix.disk" } diff --git a/_targets/armv7m7/imxrt105x/nvm.yaml b/_targets/armv7m7/imxrt105x/nvm.yaml new file mode 100644 index 00000000..c0436a18 --- /dev/null +++ b/_targets/armv7m7/imxrt105x/nvm.yaml @@ -0,0 +1,12 @@ +# example NVM config - based on EVK board +flash0: + # external qspi flash - is25wp064a (64Mbit) + size: 0x800000 # 8 MB + block_size: 0x1000 + padding_byte: 0xff + partitions: + - name: plo + offs: 0x0 + - name: user + offs: 0x11000 + # if size not set - last non-virtual partition will be extnded to the end of flash diff --git a/_targets/armv7m7/imxrt105x/preinit.plo.yaml b/_targets/armv7m7/imxrt105x/preinit.plo.yaml new file mode 100644 index 00000000..1ec84425 --- /dev/null +++ b/_targets/armv7m7/imxrt105x/preinit.plo.yaml @@ -0,0 +1,22 @@ +size: 0x1000 +is_relative: False + +contents: + # NOTE: All data/code maps need to be cacheable to allow unaligned accesses + - map itcm 0x0 0x28000 rwxcb + - map dtcm 0x20000000 0x20048000 rwcb + - map ocram 0x20200000 0x20220000 rwxcb + - map xip1 0x60000000 0x60800000 rxcb + - map io 0x40000000 0x50000000 rw + - phfs usb0 1.2 phoenixd + - phfs flash0 2.0 raw + - console 0.0 + + - if: '{{ not(env.RAM_SCRIPT) | default(false) }}' + action: call + set_base: True + device: '{{ env.BOOT_DEVICE }}' + filename: user.plo + offset: '{{ nvm[env.BOOT_DEVICE].user.offs }}' + target_magic: '{{ env.MAGIC_USER_SCRIPT }}' + diff --git a/_targets/armv7m7/imxrt105x/user.plo.yaml b/_targets/armv7m7/imxrt105x/user.plo.yaml new file mode 100644 index 00000000..48eca63b --- /dev/null +++ b/_targets/armv7m7/imxrt105x/user.plo.yaml @@ -0,0 +1,13 @@ +# kernel + initrd +magic: '{{ env.MAGIC_USER_SCRIPT }}' +size: 0x1000 +is_relative: True + +contents: + - kernel {{ env.BOOT_DEVICE }} + - app {{ env.BOOT_DEVICE }} -x dummyfs xip1 dtcm + - app {{ env.BOOT_DEVICE }} -x imxrt-multi xip1 dtcm;io + - app {{ env.BOOT_DEVICE }} -x psh xip1 dtcm + #WARN: no flash driver is being run + - wait 2000 + - go! diff --git a/_targets/armv7m7/imxrt106x/build.project b/_targets/armv7m7/imxrt106x/build.project index a13e7e1e..c4462fb0 100644 --- a/_targets/armv7m7/imxrt106x/build.project +++ b/_targets/armv7m7/imxrt106x/build.project @@ -36,70 +36,21 @@ export PORTS_AZURE_SDK=n # # Platform dependent parameters # -SIZE_PAGE=$((0x200)) -PAGE_MASK=$((0xfffffe00)) - +export SIZE_PAGE=$((0x200)) # # Project specific build # -BOOT_DEVICE="flash1" -NAME_USER_SCRIPT="user.plo" -OFFS_USER_SCRIPT=$((0x11000)) -MAGIC_USER_SCRIPT=$((0xdabaabad)) -KERNEL_OFFS=$((0x12000)) +export BOOT_DEVICE="flash1" +export MAGIC_USER_SCRIPT=dabaabad # Physical kernel address KERNEL_PHBASE=$((0x0)) # itcm start address KERNEL_PHOFFS=$((0x0)) -export KERNEL_PHADDR=$(printf "%08x" $((KERNEL_PHBASE + KERNEL_PHOFFS))) - -# All data/code maps need to be cacheable to allow unaligned accesses - -# Pre-init script is launched before user script -PREINIT_SCRIPT=( - "map itcm 0x0 0x28000 rwxcb" - "map dtcm 0x20000000 0x20058000 rwcb" - "map ocram2 0x20200000 0x20280000 rwxcb" - "map aips14 0x40000000 0x40400000 rws" - "map aips5 0x42000000 0x42100000 rws" - "map xip2 0x60000000 0x64000000 rxcb" - "map xip1 0x70000000 0x70400000 rxcb" - "phfs usb0 1.2 phoenixd" - "phfs flash0 2.0 raw" - "phfs flash1 2.1 raw" - "console 0.0") - - -# Production user script contains applications to run Phoenix-RTOS -USER_SCRIPT=( - "kernel ${BOOT_DEVICE}" - "app ${BOOT_DEVICE} -x dummyfs xip1 ocram2" - "app ${BOOT_DEVICE} -x imxrt-multi xip1 ocram2;aips14;aips5" - "app ${BOOT_DEVICE} -x psh xip1 ocram2" - "app ${BOOT_DEVICE} imxrt-flash ocram2 ocram2;aips14" - "wait 2000" - "go!") - - -# Example of user dev script which call remotely script -DEV_USER_SCRIPT=( - "echo on" - "wait 3000" - "call usb0 script-${TARGET_FAMILY}-${TARGET_SUBFAMILY}-dev.plo 5a5aa5a5") - - -REMOTE_USER_SCRIPT=( - "5a5aa5a5" - "kernel usb0" - "app usb0 -x dummyfs ocram2 ocram2" - "app usb0 -x imxrt-multi itcm dtcm" - "app usb0 -x psh ocram2 ocram2" - "copy usb0 imxrt-flash flash1 0x15000 0" - "app flash1 imxrt-flash ocram2 dtcm" - "go!") +KERNEL_PHADDR=$(printf "%08x" $((KERNEL_PHBASE + KERNEL_PHOFFS))) +export KERNEL_PHADDR b_build_project() { @@ -112,7 +63,8 @@ b_build_target() { b_log "Building $TARGET project" b_log "Building phoenix-rtos-loader" - b_mkscript_preinit + image_builder.py script --nvm "$NVM_CONFIG" --script "$PLO_SCRIPT_PREINIT" --out script.plo + RAM_SCRIPT=1 image_builder.py script --nvm "$NVM_CONFIG" --script "$PLO_SCRIPT_PREINIT" --out script-ram.plo make -C plo all @@ -122,13 +74,8 @@ b_build_target() { b_image_target() { - b_mkscript_user "${USER_SCRIPT[@]}" - b_prod_image - - # TODO: Fix b_dev_image overwriting user.plo created by b_prod_image - cp "$PLO_SCRIPT_DIR/$NAME_USER_SCRIPT" "${PREFIX_BOOT}" - - b_dev_image + image_builder.py -v partition --nvm "$NVM_CONFIG" --name user --script "$PLO_SCRIPT_USER" + image_builder.py -v disk --nvm "$NVM_CONFIG" --name flash1 --part "plo=${PREFIX_PROG_STRIPPED}plo-${TARGET_FAMILY}-${TARGET_SUBFAMILY}.img" --out "phoenix.disk" } diff --git a/_targets/armv7m7/imxrt106x/nvm.yaml b/_targets/armv7m7/imxrt106x/nvm.yaml new file mode 100644 index 00000000..516ed313 --- /dev/null +++ b/_targets/armv7m7/imxrt106x/nvm.yaml @@ -0,0 +1,19 @@ +# example NVM config - based on EVK board +flash0: + # internal flash - W25Q32JV (32Mbit) + # not used currently + size: 0x400000 # 4 MB + block_size: 0x1000 + padding_byte: 0xff + +flash1: + # external qspi flash - is25wp064a (64Mbit) + size: 0x800000 # 8 MB + block_size: 0x1000 + padding_byte: 0xff + partitions: + - name: plo + offs: 0x0 + - name: user + offs: 0x11000 + # if size not set - last non-virtual partition will be extnded to the end of flash diff --git a/_targets/armv7m7/imxrt106x/preinit.plo.yaml b/_targets/armv7m7/imxrt106x/preinit.plo.yaml new file mode 100644 index 00000000..aa399428 --- /dev/null +++ b/_targets/armv7m7/imxrt106x/preinit.plo.yaml @@ -0,0 +1,25 @@ +size: 0x1000 +is_relative: False + +contents: + # NOTE: All data/code maps need to be cacheable to allow unaligned accesses + - map itcm 0x0 0x28000 rwxcb + - map dtcm 0x20000000 0x20058000 rwcb + - map ocram2 0x20200000 0x20280000 rwxcb + - map aips14 0x40000000 0x40400000 rws + - map aips5 0x42000000 0x42100000 rws + - map xip2 0x60000000 0x64000000 rxcb + - map xip1 0x70000000 0x70400000 rxcb + - phfs usb0 1.2 phoenixd + - phfs flash0 2.0 raw + - phfs flash1 2.1 raw + - console 0.0 + + - if: '{{ not(env.RAM_SCRIPT) | default(false) }}' + action: call + set_base: True + device: '{{ env.BOOT_DEVICE }}' + filename: user.plo + offset: '{{ nvm[env.BOOT_DEVICE].user.offs }}' + target_magic: '{{ env.MAGIC_USER_SCRIPT }}' + diff --git a/_targets/armv7m7/imxrt106x/user.plo.yaml b/_targets/armv7m7/imxrt106x/user.plo.yaml new file mode 100644 index 00000000..cf1451e3 --- /dev/null +++ b/_targets/armv7m7/imxrt106x/user.plo.yaml @@ -0,0 +1,13 @@ +# kernel + initrd +magic: '{{ env.MAGIC_USER_SCRIPT }}' +size: 0x1000 +is_relative: True + +contents: + - kernel {{ env.BOOT_DEVICE }} + - app {{ env.BOOT_DEVICE }} -x dummyfs xip1 ocram2 + - app {{ env.BOOT_DEVICE }} -x imxrt-multi xip1 ocram2;aips14;aips5 + - app {{ env.BOOT_DEVICE }} -x psh xip1 ocram2 + - app {{ env.BOOT_DEVICE }} imxrt-flash ocram2 ocram2;aips14 + - wait 2000 + - go! diff --git a/_targets/armv7m7/imxrt117x/build.project b/_targets/armv7m7/imxrt117x/build.project index 0f960b04..c371a326 100644 --- a/_targets/armv7m7/imxrt117x/build.project +++ b/_targets/armv7m7/imxrt117x/build.project @@ -34,64 +34,23 @@ export PORTS_CURL=n # # Platform dependent parameters # -SIZE_PAGE=$((0x200)) -PAGE_MASK=$((0xfffffe00)) +export SIZE_PAGE=$((0x200)) # # Project specific build # +export BOOT_DEVICE="flash0" +export MAGIC_USER_SCRIPT=dabaabad BOOT_DEVICE="flash0" -NAME_USER_SCRIPT="user.plo" -OFFS_USER_SCRIPT=$((0x11000)) -MAGIC_USER_SCRIPT=$((0xdabaabad)) -KERNEL_OFFS=$((0x12000)) # Physical kernel address KERNEL_PHBASE=$((0x0)) # itcm start address KERNEL_PHOFFS=$((0x0)) -export KERNEL_PHADDR=$(printf "%08x" $((KERNEL_PHBASE + KERNEL_PHOFFS))) - -# All data/code maps need to be cacheable to allow unaligned accesses - -# Pre-init script is launched before user script -PREINIT_SCRIPT=( - "map itcm 0x0 0x40000 rwxcb" - "map dtcm 0x20000000 0x20028000 rwcb" - "map ocram2 0x202c0000 0x20340000 rwxcb" - "map aips14 0x40000000 0x41000000 rws" - "map aips5 0x42000000 0x42100000 rws" - "map xip1 0x30000000 0x30400000 rxcb" - "phfs usb0 1.2 phoenixd" - "phfs flash0 2.0 raw" - "console 0.0") - - -# Production user script contains applications to run Phoenix-RTOS -USER_SCRIPT=( - "kernel ${BOOT_DEVICE}" - "app ${BOOT_DEVICE} -x dummyfs xip1 ocram2" - "app ${BOOT_DEVICE} -x imxrt-multi xip1 ocram2;aips14;aips5" - "app ${BOOT_DEVICE} -x psh xip1 ocram2" - "wait 2000" - "go!") - -# Example of user dev script which call remotely script -DEV_USER_SCRIPT=( - "echo on" - "wait 3000" - "call usb0 script-${TARGET_FAMILY}-${TARGET_SUBFAMILY}-dev.plo 5a5aa5a5") - - -REMOTE_USER_SCRIPT=( - "5a5aa5a5" - "kernel usb0" - "app usb0 -x dummyfs ocram2 ocram2" - "app usb0 -x imxrt-multi itcm dtcm" - "app usb0 -x psh ocram2 ocram2" - "go!") +KERNEL_PHADDR=$(printf "%08x" $((KERNEL_PHBASE + KERNEL_PHOFFS))) +export KERNEL_PHADDR b_build_project() { @@ -104,7 +63,8 @@ b_build_target() { b_log "Building $TARGET project" b_log "Building phoenix-rtos-loader" - b_mkscript_preinit + image_builder.py script --nvm "$NVM_CONFIG" --script "$PLO_SCRIPT_PREINIT" --out script.plo + RAM_SCRIPT=1 image_builder.py script --nvm "$NVM_CONFIG" --script "$PLO_SCRIPT_PREINIT" --out script-ram.plo make -C plo all @@ -114,9 +74,8 @@ b_build_target() { b_image_target() { - b_mkscript_user "${USER_SCRIPT[@]}" - b_prod_image - b_dev_image + image_builder.py -v partition --nvm "$NVM_CONFIG" --name user --script "$PLO_SCRIPT_USER" + image_builder.py -v disk --nvm "$NVM_CONFIG" --part "plo=${PREFIX_PROG_STRIPPED}plo-${TARGET_FAMILY}-${TARGET_SUBFAMILY}.img" --out "phoenix.disk" } diff --git a/_targets/armv7m7/imxrt117x/nvm.yaml b/_targets/armv7m7/imxrt117x/nvm.yaml new file mode 100644 index 00000000..c0436a18 --- /dev/null +++ b/_targets/armv7m7/imxrt117x/nvm.yaml @@ -0,0 +1,12 @@ +# example NVM config - based on EVK board +flash0: + # external qspi flash - is25wp064a (64Mbit) + size: 0x800000 # 8 MB + block_size: 0x1000 + padding_byte: 0xff + partitions: + - name: plo + offs: 0x0 + - name: user + offs: 0x11000 + # if size not set - last non-virtual partition will be extnded to the end of flash diff --git a/_targets/armv7m7/imxrt117x/preinit.plo.yaml b/_targets/armv7m7/imxrt117x/preinit.plo.yaml new file mode 100644 index 00000000..cce7bbe4 --- /dev/null +++ b/_targets/armv7m7/imxrt117x/preinit.plo.yaml @@ -0,0 +1,23 @@ +size: 0x1000 +is_relative: False + +contents: + # NOTE: All data/code maps need to be cacheable to allow unaligned accesses + - map itcm 0x0 0x40000 rwxcb + - map dtcm 0x20000000 0x20028000 rwcb + - map ocram2 0x202c0000 0x20340000 rwxcb + - map aips14 0x40000000 0x41000000 rws + - map aips5 0x42000000 0x42100000 rws + - map xip1 0x30000000 0x30400000 rxcb + - phfs usb0 1.2 phoenixd + - phfs flash0 2.0 raw + - console 0.0 + + - if: '{{ not(env.RAM_SCRIPT) | default(false) }}' + action: call + set_base: True + device: '{{ env.BOOT_DEVICE }}' + filename: user.plo + offset: '{{ nvm[env.BOOT_DEVICE].user.offs }}' + target_magic: '{{ env.MAGIC_USER_SCRIPT }}' + diff --git a/_targets/armv7m7/imxrt117x/user.plo.yaml b/_targets/armv7m7/imxrt117x/user.plo.yaml new file mode 100644 index 00000000..2962c6f8 --- /dev/null +++ b/_targets/armv7m7/imxrt117x/user.plo.yaml @@ -0,0 +1,12 @@ +# kernel + initrd +magic: '{{ env.MAGIC_USER_SCRIPT }}' +size: 0x1000 +is_relative: True + +contents: + - kernel {{ env.BOOT_DEVICE }} + - app {{ env.BOOT_DEVICE }} -x dummyfs xip1 ocram2 + - app {{ env.BOOT_DEVICE }} -x imxrt-multi xip1 ocram2;aips14;aips5 + - app {{ env.BOOT_DEVICE }} -x psh xip1 ocram2 + - wait 2000 + - go!