Giter VIP home page Giter VIP logo

edbg's Introduction

Build Status

CMSIS-DAP programmer

This is a simple command line utility for programming ARM-based MCUs through CMSIS-DAP SWD interface. It works on Linux, Mac OS X and Windows. It was tested with Atmel mEDBG- and EDBG-based boards, Atmel-ICE, LPC-Link2, IBDAP and Free-DAP-based debuggers.

Installation

Binary releases can be downloaded from here. Binary releases are not tested, they are a result of automated build process. Please report if you see any issues with them.

If you want to build from the source code, simply run make all and you will get a small binary, called edbg.

Dependencies

The dependencies are minimal. In addition to normal development tools (GCC, make, etc) you will need:

  • Windows: none
  • Linux: libudev-dev
  • Mac OS X: none

Usage

Usage: edbg [options]
Options:
  -h, --help                 print this help message and exit
  -b, --verbose              print verbose messages
  -d, --version <version>    use a specified CMSIS-DAP version (default is best available)
  -x, --reset <duration>     assert the reset pin before any other operation (duration in ms)
  -e, --erase                perform a chip erase before programming
  -p, --program              program the chip
  -v, --verify               verify memory
  -k, --lock                 lock the chip (set security bit)
  -u, --unlock               unlock the chip (forces chip erase in most cases)
  -r, --read                 read the whole content of the chip flash
  -f, --file <file>          binary file to be programmed or verified; also read output file name
  -t, --target <name>        specify a target type (use '-t list' for a list of supported target types)
  -l, --list                 list all available debuggers
  -s, --serial <number>      use a debugger with a specified serial number
  -c, --clock <freq>         interface clock frequency in kHz (default 16000)
  -o, --offset <offset>      offset for the operation
  -z, --size <size>          size for the operation
  -F, --fuse <options>       operations on the fuses (use '-F help' for details)
Fuse operations format: <actions><section>,<index/range>,<value>
  <actions>     - any combination of 'r' (read), 'w' (write), 'v' (verify)
  <section>     - index of the fuse section, may be omitted if device has only
                  one section; use '-h -t <target>' for more information
  <index/range> - index of the fuse, or a range of fuses (limits separated by ':')
                  specify ':' to read all fuses
                  specify '*' to read and write values from a file
  <value>       - fuses value or file name for write and verify operations
                  immediate values must be 32 bits or less

Multiple operations may be specified in the same command. They must be separated with a ';'.

Exact fuse bits locations and values are target-dependent.

Examples

>edbg -b -t samd11 -pv -f build/Demo.bin
Debugger: ATMEL EDBG CMSIS-DAP ATML2178031800000312 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM D11D14A (Rev B)
Programming............................................... done.
Verification............................................... done.

Fuse operations:

  -F w,1,1             -- set fuse bit 1
  -F w,8:7,0           -- clear fuse bits 8 and 7
  -F v,31:0,0x12345678 -- verify that fuse bits 31-0 are equal to 0x12345678
  -F wv,5,1            -- set and verify fuse bit 5
  -F r1,:,             -- read all fuses in a section 1
  -F wv,*,fuses.bin    -- write and verify all fuses from a file
  -F w0,1,1;w1,5,0     -- set fuse bit 1 in section 0 and clear fuse bit 5 in section 1

edbg's People

Contributors

5im000n avatar aethaniel avatar ant9000 avatar ataradov avatar bogdanovs avatar daniel-k avatar diamondo25 avatar dylad avatar ejoz avatar j-rios avatar jeremysf avatar keksmassacre avatar loiclefort avatar mariorose avatar martin-vitek avatar oleszczyk avatar ooxi avatar prices avatar qbolsee avatar ragkousism avatar sarlacii avatar silseva avatar strawberryhacker avatar techaumnu avatar untaugh avatar vac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edbg's Issues

Windows build dependencies

Building edbg for windows has some dependencies (while none are indicated in README.txt)
dbg_win.c includes the followinf ddk files :

#include <ddk/hidsdi.h>
#include <ddk/hidpi.h>

Consequently, building fails with :

$ make
gcc -W -Wall -Wextra -O2 -std=gnu11 dap.c edbg.c target.c target_atmel_cm0p.c target_atmel_cm3.c target_atmel_cm4.c target_atmel_cm7.c target_atmel_cm4v2.c  dbg_win.c -lhid -lsetupapi -o edbg.exe
dbg_win.c:34:10: fatal error: ddk/hidsdi.h: No such file or directory
 #include <ddk/hidsdi.h>
          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:45: edbg.exe] Error 1

Any chance to for you to add them in your git rather than pull the whole ddk ?

Thanks.

SAMD21G18

Hi
I am using samd21G18A chip, with atmel ice I am trying to burn bootloader to it. I am getting the following response when using the command.
./edbg -t atmel_cm0p
Error: invalid response while writing the register 0x00 (count = 0, value = 7)

what can be the cause for the error.

Error: invalid response while writing the register 0x00 (count = 0, value = 0) on ATSAMD51J20A using atmel-ice

Hi,

I'm trying to connect to an ATSAMD51J20A using an atmel-ice debugger. command:

> sudo ./edbg-b56-LINUX_GCC-4f5d490 -t atmel_cm4v2 -rb -c 2000

Debugger: ATMEL Atmel-ICE CMSIS-DAP J41800048174 01.27.0082 (SJ)
Clock frequency: 2.0 MHz
Error: invalid response while writing the register 0x00 (count = 0, value = 0)

sudo is necessary because of permission issues.
All the light flash on the debugger so I think that it is connecting properly. Whenever I disconnect the MCU I get (count = 0, value = 7), so something is going on.

Do you know how to solve this issue?

Dependency Requirement

I would like to ask that you include the required dependencies in the README.md file. It does not state it, but the libudev-dev package is required to successfully compile.

Cannot run make all command on mac

After cloning, when I try to make it throws error :

git clone git://github.com/signal11/hidapi.git
Cloning into 'hidapi'...
fatal: unable to connect to github.com:
github.com[0: 192.30.253.113]: errno=Operation timed out
github.com[1: 192.30.253.112]: errno=Operation timed out

Any ideas why? I even tried it as a super user, same issues.

Big Sur compilation issues

For a fresh compile on MacOS Big Sur, I found that I needed to add

LIBS += -framework Cocoa

to the Makefile to get it to link.

Support for ATSAMB11

Awesome work so far! Very happy to see some options opening up for development outside of AVR Studio...

Anyways, more of a feature request than an issue...I have an ATSAMB11 development kit and I'm getting the following error when trying to program:

Debugger: ATMEL EDBG CMSIS-DAP ATML2534030200001457 03.0C.0191 (S) Error: unknown target device (CHIP_ID = 0x00000000)

I've tried with all of the target options (no success)...Any ideas?

add new part ATSAMD20G18A

Hi ataradov,

working perfectly with your tool. Faced a new part that is not currently supported.
ATSAMD20G18A
Debugger: ATMEL EDBG CMSIS-DAP ATML1873060200016987 01.1A.00FB (S)
Error: unknown target device (DSU_DID = 0x10001405)

I believe an added line to .h in cm0p will do the job as stated in the datasheet.

{ 0x10001405, "SAM D20G18A", 0, 256*1024, 64, 4096, 256 },

Good job!

Infinite hang in read()

Testing with LPC845 Breakout:
(gdb) r -b -t stm32g0 -r
Starting program: /devel/edbg/edbg -b -t stm32g0 -r
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.26-lp151.18.7.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Debugger: NXP Semiconductors LPC11U3x CMSIS-DAP v1.0.7 0F040028 1.10 (S)
Clock frequency: 16.0 MHz
(gdb) bt
#0 0x00007ffff78e3c61 in read () from /lib64/libc.so.6
#1 0x00000000004073b0 in dbg_dap_cmd ()
#2 0x0000000000402539 in dap_reset_link ()
#3 0x0000000000402bd7 in reconnect_debugger ()
#4 0x00000000004015d6 in main ()
Running a second time hangs even earlier:
Debugger: NXP Semiconductors LPC11U3x CMSIS-DAP v1.0.7 0F040028 1.10 (S)
Clock frequency: 16.0 MHz
(gdb) bt
#0 0x00007ffff78e3c61 in read () from /lib64/libc.so.6
#1 0x00000000004073b0 in dbg_dap_cmd ()
#2 0x0000000000401b99 in dap_get_debugger_info ()
#3 0x0000000000401598 in main ()

After hang "pyocd gdb" does not see the device.
After un/replug, "pyocd gdb" sees the device.

After running "pyocd gdb" successfull, "edbg -b -t stm32g0 -r" suceeds as far as it is expected for an unknown device.:
(gdb) r -b -t stm32g0 -r
Starting program: /devel/edbg/edbg -b -t stm32g0 -r
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.26-lp151.18.7.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Debugger: NXP Semiconductors LPC11U3x CMSIS-DAP v1.0.7 0F040028 1.10 (S)
Clock frequency: 16.0 MHz
Error: unknown target device (DBG_IDCODE = 0x00000000)

Compile for OSX.

inside dbg_mac.c I got an error on compile the variable report_size was not declared.

  char cmd = data[0];
  int res;

  memset(hid_buffer, 0xff, report_size + 1);

  hid_buffer[0] = 0x00; // Report ID

I added the line of code:

  char cmd = data[0];
  int res;
  int report_size = dbg_get_report_size();

  memset(hid_buffer, 0xff, report_size + 1);

  hid_buffer[0] = 0x00; // Report ID

This may or may not be right but it compiled and I am going to make sure it works now.

Verification Error on SAM E70

Hello,
I tried to flash an SAM E70 on the Atmel SAME7 Xplained Dev Board.
I compiled edbg from scratch. libudev-dev was need, so I installed this via apt-get.
The build had no problems.

When I tried to flash the binary, I got this error:

~/workspace-Qdev/SAME70-Blinky $ edbg -bpv -t atmel_cm7 -f bin/SAME70-Template.bin 
Debugger: ATMEL EDBG CMSIS-DAP ATML2637010000000000 02.09.0169 (S)
Target: SAM E70Q21
Programming........,....................................... done.
Verification...................................
at address 0x404000 expected 0x86, read 0x00
Error: verification failed

I seems that the MCU is not programmed. I am not sure, where I have to look
to find the problem.

Regards,
Andre

Does not build out of the box on Catalina

I have a new Catalina install, XCode and developer tools installed. But I get the following

ENG-1510:edbg travisg$ make all
git clone git://github.com/signal11/hidapi.git
Cloning into 'hidapi'...
remote: Enumerating objects: 2006, done.
remote: Total 2006 (delta 0), reused 0 (delta 0), pack-reused 2006
Receiving objects: 100% (2006/2006), 2.73 MiB | 2.37 MiB/s, done.
Resolving deltas: 100% (1172/1172), done.
cd hidapi && ./bootstrap
+ autoreconf --install --verbose --force
./bootstrap: line 2: autoreconf: command not found
make: *** [hidapi/mac/.libs/libhidapi.a] Error 127

Provide encrypted bintray API key

bintray

If you are logged into bintray, you should see a list of repositories on the left named Owned Repositories. There you can Add New Repository.

Please create a public repository named edbg of type Generic. Inside the repository you need to add a package named travis-ci. You can of cause change the names to whatever you like, I will change my pull request accordingly.

Now with the repository and package being created, we need to extract your bintray API key. It's available in the bintray web GUI at Edit Your Profile / API Key

Please do not share your API key here directly, but encrypt it using Travis CI first. The rest of this document assumes your API key is super_secret. In reallity it should look like a long hexdecimal character sequence.

Travis CI

Encrypt your bintray credentials for usage in Travis CI

travis encrypt -r ataradov/edbg BINTRAY_DEPLOYMENT_API_KEY=super_secret

You might need to install the travis gem, I recommend doing so inside an ephemeral container:

$ docker run -it --rm ubuntu:16.04
# apt-get -y update && apt-get -y install build-essential ruby ruby-dev
# gem install travis
# travis encrypt -r ataradov/edbg BINTRAY_DEPLOYMENT_API_KEY=super_secret

In my opinion, encrypting secrets for usage inside Travis CI is the most annoying part. Travis CI should offer a GUI on their website for this task ā˜¹

You should see an output similar to

  secure: "mMXpe5Vhl6vgvT/D9HwfPgamDJsuk4q9cKRidIqp3Xe2TmOr5PZ3KMxXaJhNBzRPiI/kH2pYImK3EG2pbAhFUj2D3YKyyB6B1FrE7YQB72MzTFn86MY1L+igywap/3dm7ZRDT0pGLSQCjVN9QOpbKzpcCFlLu0oLMFT23FNOj6BFN/+fHJrIW9b4x44vd3P2MPk2E4CYMr43seedPzUHmio4mrqXJKAa3sHH9BvS/E6tpeYiWNJ1+RO2e/p5AqrS1d157+hnH8upsC2BIwlkRbUEkZdrjsJjc+CNVS2IBPjXbfeD+nGIJdiKP33+s3i1lnyMUAmy8hmZ80X2sKTFElow0cxXVhEI8uwLmylSmMR50VpmLHM2VZJV16dNJ2HvadDm4ztm82fPL4Ob7sybDK34+of8BYXoSWDBJ6Fx0ABISQ1z7riargPxdGI09a0+z6ZbJwARWWPD0K0av/W/PpCMTSnV4zmcWilTkw5t9JhIRLXral5Z/ghS7u1qVBvS6SgSf46e41oSAgRJyfnPl21R4D8uU6/b2MqvslQ0re+JKMdcrSROCYIc/455SwTol1Q0YAm5d7kCFSKVVS+dfV3BdtcxvgO57VcbSRsppTSC+PzZPh0EGgf2KUyb2Rj+ZltaqJYiWgpUyVdizrfE0/kqEkE17G7lj+wh3TpoAk4="

Please paste this string here. While your bintray API key is secret and must not be shared with anybody, the encrypted string is not. It's encrypted with your public Travis CI key, thus only Travis CI will be able to decrypt the string and inject additional secret environment variables into your build environment.

Programming Speed Discussion

Hello and first of all thanks a lot for the great work!

I'm currently evaluating programming options for an atsamd21 and am benchmarking programming speeds for different tools and different programmers. At the moment, I'm noticing a massive difference between Atmel Studio and tools on linux (see below).
I would be therefore curious to know if you have done in the past some similar benchmarks?

My current results:

Atmel Studio for different SWD clocks, 142652 bytes firmware, program and verify:
Atmel-ICE:

  • 8MHz (not recommended): 12s
  • 4MHz: 13s17
  • 2MHz: 14s49
  • 1MHz: 17s40
  • 500kHz: 22s31

JLink:

  • 8MHz (not recommended): 7s5
  • 4MHz: 8s
  • 2MHz: 8s61
  • 1MHz: 9s93
  • 500kHz: 13s

Edbg on Ubuntu on Virtualbox, same firmware, erase, program and verify:
command line: sudo ./edbg-b77-LINUX_GCC-04b7508 -b -epv -t samd21 -f mini_ble.bin -c 8000
Atmel-ICE:

  • 16MHz (not recommended): 1m01
  • 8MHz (not recommended): 1m01
  • 4MHz: 1m04
  • 2MHz: 1m04

JLink: doesn't have CMSIS-DAP

OpenOCD on Ubuntu on Virtualbox, same firmware, erase, program & verify:
command line for jlink: sudo openocd -f samd21_jlink.cfg -c "init; targets; program mini_ble.bin verify reset; shutdown"
command line atmel ice: sudo openocd -f samd21_ice.cfg -c "init; targets; program mini_ble.bin verify reset; shutdown"

Atmel-ICE:

  • 2MHz: 1m04
  • 1MHz: 1m00
  • 400kHz: 1m02

JLink:

  • 8MHz: FAIL
  • 4MHz: FAIL
  • 2MHz: FAIL
  • 1MHz: 1m27
  • 500kHz: 1m27

samd21_ice.cfg file contents:
source [find interface/cmsis-dap.cfg]
set CHIPNAME at91samd21g18
set ENDIAN little
set telnet_port 0
source [find target/at91samdXX.cfg]
adapter_khz 2000

samd21_jlink.cfg file contents:
interface jlink
transport select swd
set CHIPNAME at91samd21e18
set ENDIAN little
set telnet_port 0
source [find target/at91samdXX.cfg]
adapter_khz 2000

ATSAMD21G16L does not run after a 'successful' program

After manually adding its entry, programming an ATSAMD21G16L with an Atmel-iCE and a hex file (~34kb) appears to work fine, including erasing and verifying.

However, the code on the chip does not run afterwards.

If I program the same device, with an Atmel-iCE, using Atmel Studio 7, with the same hex file, it runs just fine.

Dumping the memory from the device, after either program, reveals that the data is identical up until offset 0x00008420 (around where I expect the end of the hex file data to be).

After that though, the portion of the empty memory is different:

Dump after EDBG programming
edbg_hex

Dump after Atmel Studio 7 programming
atmel_studio_hex

Is there some other option/configuration step I'm missing?

How to get target voltage?

Hi,

I have a samr21/30 target board. I want to get the target voltage to check if my target is correctly powered before flashing?
How could I add an arg to read target voltage only?

Thanks,

Unknown Target Device: SAMD21 Xplained Pro

I have been testing this with an Atmel SAMD21 Xplained Pro board I have. When I plug the board into the debug USB port (this is what the Atmel FAEs specified was the correct way to interface to the device for programming and debugging) with the "./edbg -l" command I get, "Attached debuggers:
ATML2130021800014950 - Atmel Corp. EDBG CMSIS-DAP", but if I attempt to read the contents of the chip with the "./edbg -r" command I get, "Error: unknown target device (DSU_DID = 0x10010300)". I should point out that this board is less than a day old an I have not loaded any code onto it yet. I just wanted to test if this would be able to communicate to the device.

MinGW shows multiple EDBG debugger attached

Hi,
I'm trying to use edbg on MinGW. I used a SAMD20-Xplained board to program a custom board based on SAML21.
When I used edbg on linux or linux vm, everything runs fine.
But on MinGW, edbg said there are several debuggers attached (which is not the case)
here the output of edbg --list
Attached debuggers: ATML1873040200013344 - Atmel Corp. EDBG CMSIS-DAP EDBG CMSIS-DAP - EDBG CMSIS-DAP EDBG CMSIS-DAP EDBG CMSIS-DAP - EDBG CMSIS-DAP EDBG CMSIS-DAP
If I specify edbg -s ATML1873040200013344, it works as expected.
This is no a main issue but this is a bit annoying.
Any ideas ?

atmega support

Hi @ataradov, some Atmel AVR boards (XMINI) embed an EDBG, well an mEDBG but with similar commands.
Do you think it would be easy for you to add their support?

Thanks,
T.

Target is reset twice.

Description

This change (b65dc24#diff-00259a9e325566089cd936bcc3e75e50R564) caused targets to be reset twice. This is relevant when one just wants to reset (using, e.g., edbg -t atmel_cm0p)

The first reset:

edbg/edbg.c

Line 564 in b65dc24

dap_reset_target_hw(1);

The second reset:

edbg/edbg.c

Line 680 in b65dc24

dap_reset_target_hw(1);

Why is it relevant

In the RIOT OS test suite we reset the boards at the beginning of each test. The test script waits for a known string to start the test. With the current edbg behaviour the test starts and shortly afterwards the board is reset, causing it to fail. Since this is happening only with atmel boards using edbg, I'd like to avoid having to add a specific kludge to handle it in the test infrastructure if I can avoid it.

Steps to reproduce

Load an program that does something immediately after boot, for example output a string over the UART. In my case I'm running the RIOT OS test suite, and listening on the serial connection.

Reset the board with edbg -t <target type> (in my case atmel_cm0p.)

Expected result

Board is reset once thus the message is sent once.

Actual result

Board is reset twice in a short span thus the message is sent twice.

Review bintray directory structure

Hi,

as discussed in pull request #56, I have set up a proof of concept of how to automatically deploy edbg binaries to bintray using Travis CI.

The current setup will result in an URL looking something like

https://dl.bintray.com/ataradov/edbg/master/

where master is the branch being build. This directory contains a list of all revisions build by Travis CI. The binaries inside a build are currently named like this:

edbg-b36-LINUX_CLANG-1657458
edbg-b36-LINUX_GCC-1657458
edbg-b36-OSX_CLANG-1657458
edbg-b36-OSX_GCC-1657458
edbg-b36-WINDOWS-1657458.exe

I personally dislike the mixing of SNAKE_CASE and kebab-case, so maybe we should change the target names. What do you think?

Proxy Debug

Hello, your program run very good for flash a "same70q21". But i have a question, with this program can i make a proxydebug for debugging my firmware?

Thank

Supported file format

Hi, Alex!

I'm linux user and edbg is great thing for CLI project flow!

Which one file format supported by your tool?
bin/hex/elf???

I think edbg need simlpe check for file-extension for preventing brick the uC-device.

WBR,
Dmitry

Invalid response while writing the register with Atmel CM7 on OS X

Hi,

I'm using edbg to program an Atmel CM7. I'm compiling edbg on Windows and OS X. Initially both are not working as i'm always getting this:

Debugger: ATMEL Atmel-ICE CMSIS-DAP J41800088582 01.27.0082 (SJ)
Error: invalid response while writing the register 0x00 (count = 0, value = 7)

A hardware guy told me that the SWD clock ratio was too high compared with the CPU clock. So I went into Atmel Studio under Tools -> Device Programming and in interface settings I set the SWD clock to 128 kHz (was 2 MHz). When I hit save and go back to edbg I can now program my file on this specific machine only.

How can I do the same on OS X or Linux where Atmel Studio doesn't run?

Any help would be appreciated.

Thanks

Problem while reseting SAM4L

I'm trying to use edbg to program, and later debug, a SAM4LXplained pro board.

I had modified target.c to add the uC part number( ATSAM4LC4CA) but I'm not being able to execute any comand.
I've tried:

edbg -be -t atmel_cm4

And had the following error:

Debugger: ATMEL EDBG CMSIS-DAP ATML1783020200003186 03.19.01A3 (S)
Error: invalid response while writing the register 0x0d (count = 1, value = 4)

With gdb I found that the problem occur when the dap command to AIRCR for reset is being written.

I think that is possibly not a problem with edbg, but I want some help to figure out a solution, and to add it to edbg

Restarted builds fail because bintray does not allow overwriting existing executables

I noticed a couple of Travis CI builds look like they failed. The reason is that a restarted build gets the same build number and bintray does not allow overwriting of build artifacts by default.

Depolyment to Bintray failed with response {"message":"Unable to upload files: An artifact with the path 'master/19/edbg-b19-OSX_GCC-72ab2d2' already exists"}

I created this issue as a reminder for myself. I'll try to find a solution, at least I will check if the file exists before trying to upload it so the build will not be marked as failed in Travis CI.

Error: unable to find parent usb device

Downloads/edbg-master$ make all
gcc -W -Wall -O2 -std=gnu99 dap.c edbg.c target.c target_atmel_cm0p.c target_atmel_cm3.c target_atmel_cm4.c target_atmel_cm7.c dbg_lin.c -ludev -o edbg
aswin@aswin-fourthfrontier:~/Downloads/edbg-master$ ./edbg -bev -t atmel_cm4
Error: unable to find parent usb device

Commit 800e209 causes verification error for SAMD21J18

After commit 800e209 I get verification errors anytime I attempt to program my samd21j18 board:

edbg -t atmel_cm0p -bpv -f boot.bin
Debugger: ATMEL Atmel-ICE CMSIS-DAP J41800049111 01.26.0081 (SJ)
Clock frequency: 16.0 MHz
Target: SAM D21J18A (Rev D)
Programming........................... done.
Verification...
at address 0x0 expected 0x38, read 0xff
Error: verification failed
make: *** [flash] Error 1

I played around in target_atmel_cm0p.c and I could get occasional success by tweaking some of the changes (like converting dap_write_half and dap_write_byte back to dap_write_word) but no one line fix.

Reset needed for some targets

Writing a wrong clock config locks up my samd21g18, and makes me unable to program with edbg.

I solved this by adding dap_reset_target() after dap_connect(), but this seems to introduce another problem with the chip not running after programming, until I press reset. I don't know enough about CMSIS-DAP for a proper solution yet, but I'm looking into it.

Create a release tag

Hi,

Would it be possible to just create a release tag like 1.0? I made an homebrew formula for OS X but they require a tag/release.

Thanks

Device stuck with DAP_TRANSFER_WAIT return code

I have several samr21xpro devices each attached to several machines running Debian Jessie. Edbg has been flawlessly loading binaries to all of these devices for some time.

The latest code that was loaded for debugging onto the devices seems to have caused many (perhaps 2/3) of the samr21xpro to no longer work with edbg. All edbg operations now fail with the following:
"Error: invalid response while writing the register 0x00 (count = 1, value = 2)"

Looking through dap.c, count=1 seems to be the expected output, but value=2 seems to correspond to the DAP_TRANSFER_WAIT return code.

My understanding is that similar issues can arise when the security bit is set (I don't think I've accidentally done this), but that a chip erase will undo even the worst goof-ups. However, in this case even the erase operation fails in the above manner.

Cannot Program SAMD10 Xplained Mini

Hello,

Board was working fine for some time, but now that my program has grown in size, I am having trouble programming it. It uploads the larger program just fine but does not work after that. It responds in Microchip/Atmel Studio just fine, and if I erase the board from there then I can program it with this tool. This is using the onboard programmer; there is only a USB cable involved.

OpenOCD seems to be affected by the same issue (I know this is a different project but could be relevant if they work in similar ways).

Debugger: Atmel mEDBG CMSIS-DAP ATML2378032700000781  (SJ)
Clock frequency: 16.0 MHz
Error: invalid response during transfer (count = 0/1, status = 7)

atmel_cm0p, timing between reset and command (erase/read/flash) problem

If the GPIO use for SWCLK or SWDIO is reconfigured (MUX GPIO) just after boot on the target, edbg does not success to erase/flash/read the target

It is a timing problem

I inverted some commands on edbg.c to not loose time after board reset:

  dbg_open(&debuggers[debugger]);

----------------------------------------
  dap_get_debugger_info();

  print_clock_freq(g_clock);
----------------------------------------
// above and below has been inverted here to show success code
----------------------------------------
  dap_reset_target_hw(1);

  reconnect_debugger();
----------------------------------------
  target->ops->select(&g_target_options);

And it works great
I have no time yet to make this short pull request, so I'll will do later if nobody did it before

DAP_INFO_CAPABILITIES should be available

Hello,

I am trying to get the Blackmagic Debugger running with CMSIS_Dap adapters. I found your edbg a good start. As the DAP_PORT_JTAG may bot be implemented, is is needed outside of dap.c to know of "J" is in the return of ID_DAP_INFO/DAP_INFO_CAPABILITIES.

What would you propose to export these values?

ATSAMD21G16L unknown target device ID (after manually adding to target_atmel_cm0p.c)

I've added what I believe is the correct entry to target_atmel_cm0p.c for programming an ATSAMD21G16L device:

{ 0x10011557, "samd21", "SAM D21G16L", 64*1024 }

However, when I try and program the device I get the following error:

Debugger: ATMEL Atmel-ICE CMSIS-DAP J42700001914 01.27.0082 (SJ)
Clock frequency: 16.0 MHz
Error: unknown target device (DSU_DID = 0x10011557)

Debug SAMR21

Hi,
What's the effort to add a debug functionality in your implementation so we can use it with gdb?
Or is it already possible? Please explain me how?

releases

Hi @ataradov, do you think you could provide binary releases for all supported OS, please?

I'm integrating this tool into my Arduino SAM port (https://github.com/aethaniel/ExperimentalCore-sam) and I'm able to compile only win64 and linux64 binaries.

Usual OS targets are:

  • Win32
  • Win64
  • Lin32
  • Lin64
  • OS X

This isn't a strong request but more a nice to have. No stress ;-)

If you have a solution to remote build the project similar to the Travis-CI I'm using at the moment, I could investigate myself and provide you the binaries to bring here for a Release.

Thanks,

T.

Windows dependencies

Hi,

first of all, thank you very much for this great project! I have a question regarding Windows dependencies. The readme states that no dependencies on windows are required.

However dbg_win.c seems to need the Windows Driver Kit? I'm asking because I'm currently trying to cross compile edbg for Windows and I'm missing the ddk include directory.

Maybe the README should extended by stating the Windows Driver Kit is required, but that's normally bundled with Visual Studio?

-- ooxi

Error: invalid response while writing the register 0x0d (count = 1, value = 7)

Running on the MIMRXT1060, some register access fails fatal:
Debugger: 1.10 (S)
Clock frequency: 16.0 MHz

Breakpoint 1, dap_write_reg (reg=reg@entry=5 '\005', data=data@entry=1073829888) at dap.c:413
413 error_exit("invalid response while writing the register 0x%02x (count = %d, value = %d)",
(gdb) bt
#0 dap_write_reg (reg=reg@entry=5 '\005', data=data@entry=1073829888) at dap.c:413
#1 0x0000000000401a83 in dap_read_word (addr=addr@entry=1073829888) at dap.c:470
#2 0x0000000000405fe0 in target_select (options=0x60e180 <g_target_options>) at target_st_stm32g0.c:182
#3 0x00000000004028d1 in main (argc=, argv=) at edbg.c:496
(gdb) n
Error: invalid response while writing the register 0x05 (count = 0, value = 7)

In my BMP setup using dbg_xxx.c and dap.c, accesses to 0x400xyyyy also fail fatal. These accesses happen when the probe tests for the STM32F0. STM32L0 and LPC43 Idcode registers. I have not found a way to recover after that failure. Do you have any idea?

No license

So glad to have found this, I've been dreading building my own edbg programmer. There's no LICENSE file or stated license terms, can you clarify those in the repository?

PG164140 programmer support?

I have a Microchip PG164140 programmer coming and intend to use it for the ATSAMC21G17A.
Will the edbg software be able to program it using that programmer and MCU?

If not can you recommend another software. I use Linux command line.

microbit support

Is it feasible for me to add support for the microbit? It uses a cm0 nrf51822. I looked at the cm0p support and Iā€™m not sure what would need to be changed. Thanks, Mark.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.