You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/03/12 14:49:50 UTC

[GitHub] [mynewt-core] nkaje opened a new pull request #2239: Otp tool updates based on test dev

nkaje opened a new pull request #2239: Otp tool updates based on test dev
URL: https://github.com/apache/mynewt-core/pull/2239
 
 
   This PR brings in enhancement updates to the OTP and Serial Loading Tools.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-598256087
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-600368545
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392469994
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py
 ##########
 @@ -51,21 +52,32 @@ def load(infile, uart):
     # - If XOR matches, host sends 0x6 as final ack
     # - board boots image after receiving ACK from host
 
-#    if len(msg) == 0:
-#        raise SystemExit("Read timed out, exiting")
-
-    print("Please reset board to enter ROM uart recovery")
+    som_detected = False
+    reset_triggered = False
+    now = datetime.datetime.now()
+    reset_delay_us = 250000
 
     while True:
+        elapsed = datetime.datetime.now() - now
+        if elapsed.seconds >= 15:
+            raise SystemExit("Failed to receive SOM, aborting")
+        if not som_detected and not reset_triggered:
+            if elapsed.microseconds >= reset_delay_us:
+                print("Triggering SWD reset...")
+                os.system("./reset.sh &")
 
 Review comment:
   I am not a big run of `os.system` either, so I would use subprocess module. You could fix this with:
   
   ```
   import os.path as path
   import subprocess
   
   reset = path.join(path.dirname(__file__), 'reset.sh')
   subprocess.call(reset.split())
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] nkaje edited a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
nkaje edited a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-601887699
 
 
   Logs from OpenOCD based system
   ```
   ./da1469x_serial.py load -u /dev/ttymxc4 -r ./reset_ocd.sh image.elf.bin
   Triggering SWD reset...
   warning: No executable has been specified and target does not support
   determining executable automatically.  Try using the "file" command.
   0x16011b16 in ?? ()
   adapter speed: 1000 kHz
   target halted due to debug-request, current mode: Thread 
   xPSR: 0xf9000000 pc: 0x2000028c msp: 0x20040000
   b'\x02'
   Detected serial boot protocol
   Loading application to RAM
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392469994
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py
 ##########
 @@ -51,21 +52,32 @@ def load(infile, uart):
     # - If XOR matches, host sends 0x6 as final ack
     # - board boots image after receiving ACK from host
 
-#    if len(msg) == 0:
-#        raise SystemExit("Read timed out, exiting")
-
-    print("Please reset board to enter ROM uart recovery")
+    som_detected = False
+    reset_triggered = False
+    now = datetime.datetime.now()
+    reset_delay_us = 250000
 
     while True:
+        elapsed = datetime.datetime.now() - now
+        if elapsed.seconds >= 15:
+            raise SystemExit("Failed to receive SOM, aborting")
+        if not som_detected and not reset_triggered:
+            if elapsed.microseconds >= reset_delay_us:
+                print("Triggering SWD reset...")
+                os.system("./reset.sh &")
 
 Review comment:
   I am not a big fan of `os.system` either, so I would use subprocess module. You could fix this with:
   
   ```
   import os.path as path
   import subprocess
   
   reset = path.join(path.dirname(__file__), 'reset.sh')
   subprocess.call(reset.split())
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392397956
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/reset.sh
 ##########
 @@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ip=${1:-"localhost"}
+freq=${2:-"1000"}
+
+if [ -z $(which arm-none-eabi-gdb) ]; then
+  GDB=gdb
+else
+  GDB=arm-none-eabi-gdb
+fi
+
+GDB_CMD_FILE=${GDB_CMD_FILE:-".gdb_load"}
+OPENOCD_LOG_FILE=${OPENOCD_LOG_FILE:-".openocd_log"}
+CFG_FILE_DIR=${CFG_FILE_DIR:-"/srv/juul-test/jtest/openocd"}
+
+cat > ${GDB_CMD_FILE} << EOF
+set pagination off
+EOF
 
 Review comment:
   Adding an extra empty line here should make it easier to read.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392398166
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/reset.sh
 ##########
 @@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ip=${1:-"localhost"}
+freq=${2:-"1000"}
+
+if [ -z $(which arm-none-eabi-gdb) ]; then
+  GDB=gdb
+else
+  GDB=arm-none-eabi-gdb
+fi
+
+GDB_CMD_FILE=${GDB_CMD_FILE:-".gdb_load"}
+OPENOCD_LOG_FILE=${OPENOCD_LOG_FILE:-".openocd_log"}
+CFG_FILE_DIR=${CFG_FILE_DIR:-"/srv/juul-test/jtest/openocd"}
+
+cat > ${GDB_CMD_FILE} << EOF
+set pagination off
+EOF
+if [ "$ip" == "localhost" ]; then
+cat >> ${GDB_CMD_FILE} << EOF
 
 Review comment:
   This and the `cat` in the `else` could be indented, no? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392383216
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py
 ##########
 @@ -51,21 +52,32 @@ def load(infile, uart):
     # - If XOR matches, host sends 0x6 as final ack
     # - board boots image after receiving ACK from host
 
-#    if len(msg) == 0:
-#        raise SystemExit("Read timed out, exiting")
-
-    print("Please reset board to enter ROM uart recovery")
+    som_detected = False
+    reset_triggered = False
+    now = datetime.datetime.now()
 
 Review comment:
   * You could avoid having to type `datetime` twice by importing it as `from datetime import datetime`
   * `now` could be called something else like `prev`, `old` so it would be `elapsed = datetime.now() - prev` below 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] nkaje commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
nkaje commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r394037207
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py
 ##########
 @@ -51,21 +52,32 @@ def load(infile, uart):
     # - If XOR matches, host sends 0x6 as final ack
     # - board boots image after receiving ACK from host
 
-#    if len(msg) == 0:
-#        raise SystemExit("Read timed out, exiting")
-
-    print("Please reset board to enter ROM uart recovery")
+    som_detected = False
+    reset_triggered = False
+    now = datetime.datetime.now()
+    reset_delay_us = 250000
 
     while True:
+        elapsed = datetime.datetime.now() - now
+        if elapsed.seconds >= 15:
+            raise SystemExit("Failed to receive SOM, aborting")
+        if not som_detected and not reset_triggered:
+            if elapsed.microseconds >= reset_delay_us:
+                print("Triggering SWD reset...")
+                os.system("./reset.sh &")
 
 Review comment:
   For some reason, the serial read from the device after the reset doesn't receive expected data. I addressed all other comments except for switching os.system -> subprocess.call()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] vrahane commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
vrahane commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-604644849
 
 
   Changes look fine. I merged it since it was approved by both @utzig and @agross-korg

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-600368545
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r394378235
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/reset.sh
 ##########
 @@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ip=${1:-"localhost"}
+freq=${2:-"1000"}
+
+if [ -z $(which arm-none-eabi-gdb) ]; then
+  GDB=gdb
+else
+  GDB=arm-none-eabi-gdb
+fi
+
+GDB_CMD_FILE=${GDB_CMD_FILE:-".gdb_load"}
+OPENOCD_LOG_FILE=${OPENOCD_LOG_FILE:-".openocd_log"}
+CFG_FILE_DIR=${CFG_FILE_DIR:-"/srv/juul-test/jtest/openocd"}
+
+cat > ${GDB_CMD_FILE} << EOF
+set pagination off
+EOF
+if [ "$ip" == "localhost" ]; then
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -d > ${OPENOCD_LOG_FILE} 2>&1 &"
+EOF
+else
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; ssh -tt osf@$ip docker-compose exec jtest \
+openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -f ${CFG_FILE_DIR}/bindto.cfg -d > .openocd_log 2>&1 &"
+EOF
+fi
+cat >> ${GDB_CMD_FILE} << EOF
+target remote ${ip}:3333
+mon adapter_khz ${freq}
+mon reset halt
+mon resume
+
+set *(int *)0x100C0050 = 1
 
 Review comment:
   > HW RESET REQ. added a comment.
   
   Yeah, I checked the DS this morning, I think it would be possible to add a comment but it's OK anyway.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392398345
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/reset.sh
 ##########
 @@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ip=${1:-"localhost"}
+freq=${2:-"1000"}
+
+if [ -z $(which arm-none-eabi-gdb) ]; then
+  GDB=gdb
+else
+  GDB=arm-none-eabi-gdb
+fi
+
+GDB_CMD_FILE=${GDB_CMD_FILE:-".gdb_load"}
+OPENOCD_LOG_FILE=${OPENOCD_LOG_FILE:-".openocd_log"}
+CFG_FILE_DIR=${CFG_FILE_DIR:-"/srv/juul-test/jtest/openocd"}
+
+cat > ${GDB_CMD_FILE} << EOF
+set pagination off
+EOF
+if [ "$ip" == "localhost" ]; then
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -d > ${OPENOCD_LOG_FILE} 2>&1 &"
+EOF
+else
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; ssh -tt osf@$ip docker-compose exec jtest \
+openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -f ${CFG_FILE_DIR}/bindto.cfg -d > .openocd_log 2>&1 &"
+EOF
+fi
 
 Review comment:
   Adding an empty line should make it easier to read.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] vrahane merged pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
vrahane merged pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] nkaje commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
nkaje commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-601887699
 
 
   Logs from OpenOCD based system
   ```
   ./da1469x_serial_new.py load -u /dev/ttymxc4 -r ./reset_ocd.sh 
   Triggering SWD reset...
   warning: No executable has been specified and target does not support
   determining executable automatically.  Try using the "file" command.
   0x16011b16 in ?? ()
   adapter speed: 1000 kHz
   target halted due to debug-request, current mode: Thread 
   xPSR: 0xf9000000 pc: 0x2000028c msp: 0x20040000
   b'\x02'
   Detected serial boot protocol
   Loading application to RAM
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-601263698
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] nkaje commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
nkaje commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r394376308
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/reset.sh
 ##########
 @@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ip=${1:-"localhost"}
+freq=${2:-"1000"}
+
+if [ -z $(which arm-none-eabi-gdb) ]; then
+  GDB=gdb
+else
+  GDB=arm-none-eabi-gdb
+fi
+
+GDB_CMD_FILE=${GDB_CMD_FILE:-".gdb_load"}
+OPENOCD_LOG_FILE=${OPENOCD_LOG_FILE:-".openocd_log"}
+CFG_FILE_DIR=${CFG_FILE_DIR:-"/srv/juul-test/jtest/openocd"}
+
+cat > ${GDB_CMD_FILE} << EOF
+set pagination off
+EOF
+if [ "$ip" == "localhost" ]; then
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -d > ${OPENOCD_LOG_FILE} 2>&1 &"
+EOF
+else
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; ssh -tt osf@$ip docker-compose exec jtest \
+openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -f ${CFG_FILE_DIR}/bindto.cfg -d > .openocd_log 2>&1 &"
+EOF
+fi
+cat >> ${GDB_CMD_FILE} << EOF
+target remote ${ip}:3333
+mon adapter_khz ${freq}
+mon reset halt
+mon resume
+
+set *(int *)0x100C0050 = 1
 
 Review comment:
   HW RESET REQ. added a comment.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] agross-korg commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
agross-korg commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392453542
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py
 ##########
 @@ -51,21 +52,32 @@ def load(infile, uart):
     # - If XOR matches, host sends 0x6 as final ack
     # - board boots image after receiving ACK from host
 
-#    if len(msg) == 0:
-#        raise SystemExit("Read timed out, exiting")
-
-    print("Please reset board to enter ROM uart recovery")
+    som_detected = False
+    reset_triggered = False
+    now = datetime.datetime.now()
+    reset_delay_us = 250000
 
     while True:
+        elapsed = datetime.datetime.now() - now
+        if elapsed.seconds >= 15:
+            raise SystemExit("Failed to receive SOM, aborting")
+        if not som_detected and not reset_triggered:
+            if elapsed.microseconds >= reset_delay_us:
+                print("Triggering SWD reset...")
+                os.system("./reset.sh &")
 
 Review comment:
   ah good point.  this really needs to be "reset.sh &" and the pathing must include the path to it.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-598256087
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] nkaje edited a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
nkaje edited a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-601887699
 
 
   Logs from OpenOCD based system
   ```
   ./da1469x_serial.py load -u /dev/ttymxc4 -r ./reset_ocd.sh 
   Triggering SWD reset...
   warning: No executable has been specified and target does not support
   determining executable automatically.  Try using the "file" command.
   0x16011b16 in ?? ()
   adapter speed: 1000 kHz
   target halted due to debug-request, current mode: Thread 
   xPSR: 0xf9000000 pc: 0x2000028c msp: 0x20040000
   b'\x02'
   Detected serial boot protocol
   Loading application to RAM
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392395095
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py
 ##########
 @@ -51,21 +52,32 @@ def load(infile, uart):
     # - If XOR matches, host sends 0x6 as final ack
     # - board boots image after receiving ACK from host
 
-#    if len(msg) == 0:
-#        raise SystemExit("Read timed out, exiting")
-
-    print("Please reset board to enter ROM uart recovery")
+    som_detected = False
+    reset_triggered = False
+    now = datetime.datetime.now()
+    reset_delay_us = 250000
 
     while True:
+        elapsed = datetime.datetime.now() - now
+        if elapsed.seconds >= 15:
+            raise SystemExit("Failed to receive SOM, aborting")
+        if not som_detected and not reset_triggered:
+            if elapsed.microseconds >= reset_delay_us:
+                print("Triggering SWD reset...")
+                os.system("./reset.sh &")
 
 Review comment:
   Doing this the script can only run `reset.sh` in the local directory, if I run it from repo root, eg, `./hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py`, it would not find the reset script. Not strictly required though.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-600646978
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392396487
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/otp_tool.py
 ##########
 @@ -593,16 +616,18 @@ def test_alive_target(uart):
         raise SystemExit("Failed to write to %s" % uart)
 
     data = ser.read(rlen)
-    print(data)
     if len(data) != rlen:
         raise SystemExit("Failed to receive response, exiting")
 
     response = cmd_response._make(struct.unpack_from('IIII', data))
+    if response.som != 0x55aa55aa:
+        raise SystemExit("SOM not valid, invalid response")
 
 Review comment:
   Some copy/paste here. Although the checks must be done there could be a bit or reuse so in case `0x55aa55aa` or the error message needs to change no find/replace is required.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#issuecomment-600646978
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392396902
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/reset.sh
 ##########
 @@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ip=${1:-"localhost"}
+freq=${2:-"1000"}
+
+if [ -z $(which arm-none-eabi-gdb) ]; then
+  GDB=gdb
+else
+  GDB=arm-none-eabi-gdb
+fi
+
+GDB_CMD_FILE=${GDB_CMD_FILE:-".gdb_load"}
+OPENOCD_LOG_FILE=${OPENOCD_LOG_FILE:-".openocd_log"}
+CFG_FILE_DIR=${CFG_FILE_DIR:-"/srv/juul-test/jtest/openocd"}
+
+cat > ${GDB_CMD_FILE} << EOF
+set pagination off
+EOF
+if [ "$ip" == "localhost" ]; then
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -d > ${OPENOCD_LOG_FILE} 2>&1 &"
+EOF
+else
+cat >> ${GDB_CMD_FILE} << EOF
+shell sh -c "trap '' 2; ssh -tt osf@$ip docker-compose exec jtest \
+openocd -f ${CFG_FILE_DIR}/ft4232h.cfg -f ${CFG_FILE_DIR}/steam.cfg -f ${CFG_FILE_DIR}/bindto.cfg -d > .openocd_log 2>&1 &"
+EOF
+fi
+cat >> ${GDB_CMD_FILE} << EOF
+target remote ${ip}:3333
+mon adapter_khz ${freq}
+mon reset halt
+mon resume
+
+set *(int *)0x100C0050 = 1
 
 Review comment:
   What does this do?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services