Partial support for JLink upload added

Information on the latest releases
Post Reply
User avatar
RogerClark
Posts: 6130
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Partial support for JLink upload added

Post by RogerClark » Sun Oct 16, 2016 6:11 am

I have added JLInk upload support to the generic STM32F103C8 (blue Pill etc)

I added the script for both Windows and Linux, but I can't test the Linux version, as I don't have a physical Linux machine that is working order at the moment.

The Windows version works, but anyone wanting to use it, needs to add the path to Jlink.exe (JLink Commander) to their path, as this varies depending on what version of JLInk you have installed (on Windows), and I found the only practical way to do this was to assume the command is in the PATH.

The same issues as for STLInk and BPM apply in terms of initial upload may require Boot0 high because the default config in the core is to disable the SWD pins and re-assign them as GPIO, but subsequent uploads dont have this issue.

Serial USB is enabled for JLink, as it doesnt have any form of UART passthough that I'm aware of.

Note.
I have not investigated this option for OSX

I also only added it to the BluePill.

To add to other boards, I may need to pass the device type from Boards.txt though platform.txt to the jlink_upload script, because at the moment this is hard coded to the value STM32F103C8, which seems to work OK on other boards e.g. I tried it on a STM32F103VET board, but it may not upload more than 64k of Flash, as it may believe that the device does not have enough Flash to hold the upload.

But as I suspect very few people will use this (apart from the handfull who have asked for it), I'm not going to loose sleep over this.

If anyone wants OSX support, Please let me know how the OSX command line for JLInk is called.

Cheers

Roger

User avatar
VK3TY
Posts: 16
Joined: Wed Oct 05, 2016 9:45 am
Location: Geelong, Victoria, Australia
Contact:

Re: Partial support for JLink upload added

Post by VK3TY » Mon Oct 17, 2016 12:07 am

Roger,
  • Just uploaded from GitHub and tested using the latest version 0.1.2 on my LinuxMint 17.3 platform Arduino 1.6.10. Using the same old "Blink without Delay" program, I have the same results as yesterday evening;-

    Code: Select all

    Linking everything together...
    "/home/nick/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T/home/nick/arduino/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/ld/jtag_c8.ld" "-Wl,-Map,/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.map" "-L/home/nick/arduino/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/ld" -o "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.elf" "-L/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/sketch/BlinkWithoutDelay.ino.cpp.o" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/core/wirish/start.S.o" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/core/wirish/start_c.c.o" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/core/wirish/syscalls.c.o" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/core/board.cpp.o" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/core/wirish/boards.cpp.o" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/core/wirish/boards_setup.cpp.o" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/core/core.a" -Wl,--end-group
    "/home/nick/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary  "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.elf" "/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.bin"
    
    Sketch uses 12,868 bytes (19%) of program storage space. Maximum is 65,536 bytes.
    Global variables use 2,800 bytes of dynamic memory.
    /home/nick/arduino/hardware/Arduino_STM32/tools/linux/jlink_upload /tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.bin 
    *** echo off
    *** TRACE: $tmpBinFilePath=/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.bin
     
    *** TRACE: $tmpBinFilePath.jlink=/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.bin.jlink
    SEGGER J-Link Commander V6.10d (Compiled Oct  6 2016 22:13:04)
    DLL version V6.10d, compiled Oct  6 2016 22:12:56
    
    
    Script file read successfully.
    Processing script file...
    
    J-Link connection not established yet but required for command.
    Connecting to J-Link via USB...O.K.
    Firmware: J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
    Hardware version: V7.00
    S/N: 20160703
    License(s): RDI,FlashDL,FlashBP,JFlash,GDBFull
    VTref = 3.300V
    Target connection not established yet but required for command.
    Device "STM32F103C8" selected.
    Could not measure total IR len. TDO is constant high.
    STM32 (connect): Can not attach to CPU. Trying connect under reset.
    Could not measure total IR len. TDO is constant high.
    Could not measure total IR len. TDO is constant high.
    STM32 (connect): Can not attach to CPU. Trying connect under reset.
    Could not measure total IR len. TDO is constant high.
    
    ****** Error: STM32: Connecting to CPU via connect under reset failed.
    
    
    Found SWD-DP with ID 0x1BA01477
    Found SWD-DP with ID 0x1BA01477
    AP-IDR: 0x14770011, Type: AHB-AP
    Found Cortex-M3 r1p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl 0 @ E00FF000
    ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 001BB000 SCS
    ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 001BB002 DWT
    ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 000BB003 FPB
    ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 001BB001 ITM
    ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 001BB923 TPIU-Lite
    Cortex-M3 identified.
    Halting CPU for downloading file.
    Downloading file [/tmp/build642595c231e601b4058c76a98d1ba4d8.tmp/BlinkWithoutDelay.ino.bin]...
    Writing target memory failed.
    
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    
    Script processing completed.
    
    Not sure why the same errors appear
    • J-Link connection not established yet but required for command.
    • STM32 (connect): Can not attach to CPU. Trying connect under reset. <-- (occurs twice)
    • ****** Error: STM32: Connecting to CPU via connect under reset failed.
    • Writing target memory failed.
    Tending to suspect a JLink scripting error - what would I know ;) . After these many hours, still "discovering".
Regards,
Nick
Rgds,
Nick - VK3TY

User avatar
RogerClark
Posts: 6130
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Partial support for JLink upload added

Post by RogerClark » Mon Oct 17, 2016 1:26 am

Try pulling Boot0 high, the pin config on the board may currently have the SWD pins disabled, and this would re-enable them, and wait for upload

User avatar
RogerClark
Posts: 6130
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Partial support for JLink upload added

Post by RogerClark » Mon Oct 17, 2016 1:54 am

Pull from the repo again, as its now working for me

There were 2 problems

1. Somehow the linux execute permission had been removed, so the script would not run
2. I was using the path to the latest version of JLink, (6.10) but I had to downgrade my machine as 6.10 didn't work. Fortunately JLink has a common folder called JLink which has symbolic links to the actual binaries, so I changed the script to use the symbolic link(s)

I've tested it on my Linux Mint 64 machine, and it now seems to work fine.

User avatar
VK3TY
Posts: 16
Joined: Wed Oct 05, 2016 9:45 am
Location: Geelong, Victoria, Australia
Contact:

Re: Partial support for JLink upload added

Post by VK3TY » Tue Oct 18, 2016 10:57 pm

  • The core problem was the JLink script (jlink_load). The revised script worked perfectly. No issues with permissions or access.

    Running the "install.sh" took care of permissions and set the path (removing the necessity for symbolic linking).

    For me (at least), running it all under Linux has been taxing but rewarding.

    I'm finishing of the documentation in the nest couple of days so will post the final of the drafts there-after.

    Now to develop a project that will make use of the speed and data-width offered by the SMT32 family. It will have to be a tad better than the standard "Blink" ;)
Rgds,
Nick - VK3TY

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests