SparkFun Forums 

Where electronics enthusiasts find answers.

Everything with the AmbiqSuite SDK tools and software are welcome here.
#221793
I am getting familiar with Ambiq apollo3 blue using the artemis_dk development board. I liked the approach taken with the artemis_dev_platform so I set that up to be my build environment. This will be really helpful down the road when I am ready to set up CI/CD.

Currently I'm trying to figure out how to debug with cortex-debug in visual studio. I've been using "professional" IDE's including SES, Keil and IAR for years, but it seems like VS Code+cortex-debug is a great alternative.

Since the artemis_dk includes a DAPLink interface, I installed pyocd. I had a bit of doubt at first as far as the launch configuration, but I think I have it figured out now.

I'll include it here just FYI:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"request": "launch",
"name": "Cortex Debug",
"cwd": "${workspaceRoot}/boards_sfe/common/examples/ble_freertos_tag", // workspaceRoot refers to the VSCode root workspace
"executable": "${workspaceRoot}/boards_sfe/common/examples/ble_freertos_tag/gcc/artemis_dk/bin/ble_freertos_tag_asb.axf",
"serverpath": "C:/Python37/Scripts/pyocd-gdbserver.exe",
"servertype": "pyocd",
"device": "AMA3B1KK-KBR",
"interface": "swd", // or "jtag" - but usually "swd"
"serialNumber": "", //if you have more than one J-Link probe add the serial number here
"runToMain": true,
"svdFile": "AmbiqSuiteSDK/pack/SVD/apollo3.svd",
}
]
}

One of my main points of confusion at first was where to find the elf file, but eventually I realized the axf file is elf format.

PROBLEM #1:

I'm getting so close to being able to debug but I hit a snag. The axf built in artemis_dev_platform has all the files starting at /app which is the root of the virtual file system for the docker container. When I start debugging it produces errors like this:

Launching server: "C:/Python37/Scripts/pyocd-gdbserver.exe" "--persist" "--port" "50000" "--telnet-port" "50001"
Launching GDB: "arm-none-eabi-gdb.exe" "-q" "--interpreter=mi2"
Reading symbols from D:\Flipperz\artemis_dev_docker\artemis_dev_platform\AmbiqSuiteSDK/boards_sfe/common/examples/ble_freertos_tag/gcc/artemis_dk/bin/ble_freertos_tag_asb.axf...
done.
0x00023950 in vTaskStepTick (xTicksToJump=23160) at /app/AmbiqSuiteSDK/third_party/FreeRTOSv10.1.1/Source/tasks.c:2552


Is there a good trick for getting cortex-debug to get cortex-debug to find the files through a different path?

PROBLEM #2:

Also I'm having a problem that I supect is an issue with cortex-debug and pyOCD but wondering if anyone has seen this before:

0000729:WARNING:gdb_server:pyocd-gdbserver is deprecated; please use the new combined pyocd tool.
0000902:WARNING:mbed_board:Board ID A127 is not recognized, using generic cortex_m target.
0000902:WARNING:board:Generic 'cortex_m' target type is selected by default; is this intentional? You will be able to debug most devices, but not program flash. To set the target type use the '--target' argument or 'target_override' option. Use 'pyocd list --targets' to see available targets types.
0000902:INFO:board:Target type is cortex_m
0000933:INFO:dap:DP IDR = 0x2ba01477 (v1 rev2)
0000943:INFO:ap:AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2)
0000964:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=43b part=4c4)
0000971:INFO:rom_table:[0]<e000e000:SCS-M4 class=14 designer=43b part=00c>
0000976:INFO:rom_table:[1]<e0001000:DWT class=14 designer=43b part=002>
0000981:INFO:rom_table:[2]<e0002000:FPB class=14 designer=43b part=003>
0000986:INFO:rom_table:[3]<e0000000:ITM class=14 designer=43b part=001>
0000991:INFO:rom_table:[4]<e0040000:TPIU-M4 class=9 designer=43b part=9a1 devtype=11 archid=0000 devid=ca0:0:0>
0000994:INFO:cortex_m:CPU core #0 is Cortex-M4 r0p1
0001002:INFO:cortex_m:FPU present: FPv4-SP-D16-M
0001007:INFO:dwt:4 hardware watchpoints
0001010:INFO:fpb:6 hardware breakpoints, 4 literal comparators
0001039:INFO:server:Semihost server started on port 50001 (core 0)
0001065:INFO:gdbserver:GDB server started on port 50000 (core 0)
0001149:INFO:gdbserver:One client connected!
0001202:INFO:gdbserver:Attempting to load argon
0001202:INFO:gdbserver:Attempting to load freertos
0001204:INFO:gdbserver:freertos loaded successfully
0001215:ERROR:gdbserver:Transfer failure while executing remote command 'reset halt': No ACK received
Traceback (most recent call last):
File "c:\python37\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 286, in read_ap_result_callback
return result()
File "c:\python37\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 833, in read_reg_cb
res = transfer.get_result()
File "c:\python37\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 143, in get_result
self.daplink.flush()
File "c:\python37\lib\site-packages\pyocd\utility\concurrency.py", line 28, in _locking
return func(self, *args, **kwargs)
File "c:\python37\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 667, in flush
self._read_packet()
File "c:\python37\lib\site-packages\pyocd\utility\concurrency.py", line 28, in _locking
return func(self, *args, **kwargs)
File "c:\python37\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 918, in _read_packet
decoded_data = cmd.decode_data(raw_data)
File "c:\python37\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 451, in decode_data
data = self._decode_transfer_data(data)
File "c:\python37\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 358, in _decode_transfer_data
self._check_response(data[2])
File "c:\python37\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 341, in _check_response
raise DAPAccessIntf.TransferError("No ACK received")
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: No ACK received

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "c:\python37\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 1008, in handle_remote_command
self._command_context.process_command_line(cmd)
File "c:\python37\lib\site-packages\pyocd\commands\execution_context.py", line 281, in process_command_line
invoc.handler(invoc)
File "c:\python37\lib\site-packages\pyocd\commands\execution_context.py", line 352, in execute_command
cmd_object.execute()
File "c:\python37\lib\site-packages\pyocd\commands\commands.py", line 344, in execute
self.context.target.reset_and_halt()
File "c:\python37\lib\site-packages\pyocd\core\soc_target.py", line 219, in reset_and_halt
return self.selected_core.reset_and_halt(reset_type)
File "c:\python37\lib\site-packages\pyocd\coresight\cortex_m.py", line 810, in reset_and_halt
if self.get_state() not in (Target.State.RESET, Target.State.RUNNING):
File "c:\python37\lib\site-packages\pyocd\coresight\cortex_m.py", line 828, in get_state
dhcsr = self.read_memory(CortexM.DHCSR)
File "c:\python37\lib\site-packages\pyocd\coresight\cortex_m.py", line 436, in read_memory
result = self.ap.read_memory(addr, transfer_size, now)
File "c:\python37\lib\site-packages\pyocd\utility\concurrency.py", line 28, in _locking
return func(self, *args, **kwargs)
File "c:\python37\lib\site-packages\pyocd\coresight\ap.py", line 883, in _read_memory
result = read_mem_cb()
File "c:\python37\lib\site-packages\pyocd\coresight\ap.py", line 864, in read_mem_cb
res = result_cb()
File "c:\python37\lib\site-packages\pyocd\coresight\dap.py", line 603, in read_ap_cb
result = result_cb()
File "c:\python37\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 288, in read_ap_result_callback
six.raise_from(self._convert_exception(error), error)
File "<string>", line 3, in raise_from
pyocd.core.exceptions.TransferError: No ACK received

For some reason pyOCD is having trouble communicating via DAPLink to the AMA3B1KK-KBR, do I need to provide additional parameters to pyOCD?
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]