Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist: jlink: flash mcu based on serial number #5235

Merged
merged 1 commit into from
Apr 5, 2016

Conversation

basilfx
Copy link
Member

@basilfx basilfx commented Apr 3, 2016

Having two of the same boards connected, JLink will flash the last one enumerated when running make flash. This is unhandy when developing client/server applications at the same time :-)

This PR adds the option to specify the board's serial number using the environment variable JLINK_SERIAL. For instance, JLINK_SERIAL=440037009 make flash. It uses the -SelectEmuBySN option, which only exists for JLink, not JLinkGDBServer. Therefore, this option does not work for make debug or make debug-server (at least, I haven't found a solution).

To find the serial number, you can run JLink, then run the ShowEmuList command. Note that the serial number is not the MCU's unique ID.

@OlegHahm OlegHahm added this to the Release 2016.07 milestone Apr 3, 2016
@OlegHahm OlegHahm added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: tools Area: Supplementary tools labels Apr 3, 2016
@@ -122,11 +122,20 @@ test_tui() {
fi
}

test_opts() {
if [ ! -z "${JLINK_SERIAL}" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-n is a shorter form of ! -z

@jnohlgard
Copy link
Member

ACK in general, but could someone else take this assignment? I don't own a JLink adapter to test with.

@jnohlgard jnohlgard assigned OlegHahm and unassigned jnohlgard Apr 4, 2016
@OlegHahm OlegHahm assigned haukepetersen and unassigned OlegHahm Apr 4, 2016
@OlegHahm
Copy link
Member

OlegHahm commented Apr 4, 2016

@haukepetersen or @cgundogan, don't you have a JLink in your office?

@basilfx
Copy link
Member Author

basilfx commented Apr 4, 2016

Fixed comment by @gebart and rebased.

@DipSwitch
Copy link
Member

I haz a J-Link

On Mon, Apr 4, 2016 at 7:21 PM, Bas Stottelaar notifications@github.com
wrote:

Fixed comment by @gebart https://github.com/gebart and rebased.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#5235 (comment)

@OlegHahm OlegHahm assigned DipSwitch and unassigned haukepetersen Apr 4, 2016
@DipSwitch
Copy link
Member

For JLinkGDBServerCL you can use jlinkgdbserver -select usb=<SERIAL_NUMBER> section 3.3.5.21 -select of https://www.segger.com/admin/uploads/productDocs/UM08001_JLink.pdf

Edit: Maybe the prefix (now -SelectEmuBySN) can be included as a parameter for the test_opts functions to easily handle the -select usb=.. for the debug server.

@@ -122,11 +122,20 @@ test_tui() {
fi
}

test_opts() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_opts could be named test_serial I guess. This is more readable and other options should have other test functions imo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this before. I can rename it back. Shall I then also change JLINK_OPTS to JLINK_SERIAL?

@basilfx
Copy link
Member Author

basilfx commented Apr 4, 2016

Verified that -select usb=<SERIAL_NUMBER> works, so added support for it.

Renamed test_opts to test_serial. IMHO JLINK_SERVER_SERIAL is cleaner and simpler than specifying it as a parameter to test_serial

@DipSwitch
Copy link
Member

Touche on the JLINK_SERIAL_SERVER !

The flash seems to work as expected, but one small problem with the GDB server.

Edit: You may fix and squash in one go

else
JLINK_OPTS=""
JLINK_SERIAL="-SelectEmuBySN '${JLINK_SERIAL}'"
JLINK_SERIAL_SERVER="-select usb='${JLINK_SERIAL}'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please swap line 127 and 128 because now you write the updated JLINK_SERVER to the JLINK_SERIAL_SERVER variable.

@basilfx basilfx force-pushed the feature/jlink_serial branch 2 times, most recently from 433b7d7 to c63fcf8 Compare April 4, 2016 21:47
@basilfx
Copy link
Member Author

basilfx commented Apr 4, 2016

Fixed, squashed and rebased.

@DipSwitch
Copy link
Member

ACK

@DipSwitch DipSwitch added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 4, 2016
@OlegHahm OlegHahm merged commit 3b07949 into RIOT-OS:master Apr 5, 2016
@basilfx basilfx deleted the feature/jlink_serial branch April 5, 2016 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants