Environment setup:

Minimal python version

Python 3.6.8

Configuration:

Openocd

yum install libusbx-devel
sudo apt update
sudo apt install libusb-1.0-0-dev

Warning: udev rules must be copied and reloaded when an update is made.

sudo cp ext/openocd/code/contrib/60-openocd.rules /etc/udev/rules.d/60-openocd.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

If your are not a member of plugdev group, please adapt the udev file.


Lauterbach

You must install Trace32 in order to use the Lauterbach interface. In your config.t32 file (located in your T32 installation directory), you must add the following

<mandatory empty line>
RCL=NETTCP
PORT=21000
<mandatory empty line>

Switching between Lauterbach and openocd

You have to chose the interface by setting the NX_EMBEDDED_TOOLS_IFACE variable in your env:

# To use the Lauterbach interface
export NX_EMBEDDED_TOOLS_IFACE=lauterbach
# To use the openocd one.
export NX_EMBEDDED_TOOLS_IFACE=openocd

If not set, the openocd interface will be used.


Additionnal configuration

Warning: This should be done at each update. Warning: Be sure to update the git submodules using the –recursive option:

git submodule sync --recursive
git submodule update  --recursive

Additionnal configuration is necessary to use nx_embedded_tools and openocd.

  • Venv configuration.

  • Openocd compilation.

These steps are done by the setup.sh script:

./setup.sh

You also must add the py/ directory to your path:

export PATH=$PATH:<path>/nx_embedded_tools/py
#or (if you're in nx_embedded_tools directory)
export PATH=$PATH:$PWD/py

Note: You can set the $PATH variable in the ~/.bashrc file for a permanent change.

Start OpenOCD:

There are 3 ways to start OpenOCD:

  • Using NanoXplore’s ANGIE adapter. (J28 port)

or

  • Using FTDI C232HM cable + Lauterbach LA-3722 adapter. (J12 port)

or

  • Using FTDI C232HM cable. (J28 port)

Board connection:

Top view of the jtag 20 connector connected to the FTDI C232HM-DDHSL-0 cable:

(1)       . .
   Grey   . .
   Yellow . .
   Brown  . .
   Orange . .
          . .
   Green  . .
   Purple . .
          . .
          . . Black
Connector view

Top view of the J28 connector:

Grey (1). . Black
Brown   . .
Orange  . .
Yellow  . .
Green   . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
Connector view

Top view of the J28 connector:

Connector view

Board configuration (Bring-up only):

Warning: Nxbase2 works only on Bring-up board and not Dev-kit board.

nxbase2_cli -f <command_file>

Multiple command file are provided in the file/nxbase2 directory.

# Boot on spacewire with flash #3 targeting internal flash
nxbase2_cli -f files/nxbase2/boot_spacewire_sequential_internal.cmds

Start OpenOCD

Warning: In case you execute a hard reset, you must re-start openocd.

To use ANGIE Adapter: Make sure the J8 jumper is closed.

cd ext/openocd/code
src/openocd -f tcl/interface/angie.cfg -f tcl/target/ngultra.cfg

To use FTDI LA-3722 adapter: Make sure the J8 jumper is open.

cd ext/openocd/code
src/openocd  -f tcl/interface/ftdi/c232hm.cfg -f tcl/target/ngultra.cfg -c "ftdi tdo_sample_edge falling; ftdi layout_signal nTRST -alias GPIOL0; ftdi layout_signal nSRST -alias GPIOL1; reset_config trst_and_srst; adapter speed 10000"

We provide a way to autostart openocd when needed:

  • each time a script that needs a communication with the board;

  • when NX_EMBEDDED_TOOLS_IFACE=openocd is selected.

A log file is created: openocd.log in current directory.

To enable this feature you need to set the value AUTO_RUN_OPENOCD var to ‘Y’:

export AUTO_RUN_OPENOCD=y

To disable this feature:

unset AUTO_RUN_OPENOCD

Known issues

OpenOCD errors

When OpenOCD exit with this error:

Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselecting 'jtag'
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
Warn : Transport "jtag" was already selected
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : ANGIE device is already running ANGIE firmware
Info : ANGIE signal states: TDI: 0, TDO: 1, TMS: 0, TCK: 1, TRST: 1 SRST: 1
Info : clock speed 10000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: NGULTRA.coresight.cpu: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (7) in DAP response
Error: JTAG-DP STICKY ERROR

There is two things to do: 1- Make sure Jumper J8 is closed, then try again.

If you encounter this error while J8 closed (Rare issue): 2- Unplug + Re-plug ANGIE solves the issue.

OpenOCD and EL1 execution

When using OpenOCD to debug at EL1, it may falsely detect that an MMU is activated and will try to disable it.

A fix to this error may consist to change the target in ngultra configuration of openocd:

  1. Open ext/openocd/code/tcl/target/ngultra.cfg;

  2. Change all references from aarch64 to armv8r;

  3. Restart OpenOCD.

Multiple ELF file load with OpenOCD when instruction cache is activated

Multiple ELF file load with OpenOCD when instruction cache is activated will lead to execution errors. To avoid this issue, you must reboot your board between each load.

Using Angie probe may be very slow

Using Angie as a debug probe may be very slow. If you need more speed please use FTDI cable or Lauterbach Trace 32 solution.

© NanoXplore 2022