Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
help developing for stm32 target?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
barfo
Apprentice
Apprentice


Joined: 04 Mar 2006
Posts: 163

PostPosted: Sat Jul 18, 2009 2:40 pm    Post subject: help developing for stm32 target? Reply with quote

hi all... i'm stumped and don't know where else to turn.

i know this forum is intended for those running gentoo on alternative or embedded archs, but i'm hoping someone can point me in the right direction and this seemed like the best place.

i have usually developed for AVRs in windows only because it's what i had in the office/lab, but i have an olimex STM32-sk board at home i received from a vendor some time ago and an IAR usb J-link.

i found openocd and am trying to get it set up so i can develop for this board at home in gentoo. does anyone know:
how do i interface the jlink usb adapter?
is this jtag interface even supported in linux?

when i connect the jlink adapter, i see this in /var/log/messages:
Code:
Jul 18 09:30:30 mrblack usb 2-1: new full speed USB device using uhci_hcd and address 51
Jul 18 09:30:30 mrblack usb 2-1: configuration #1 chosen from 1 choice
Jul 18 09:30:30 mrblack usb 2-2: new full speed USB device using uhci_hcd and address 52
Jul 18 09:30:30 mrblack usb 2-2: device descriptor read/64, error -71
Jul 18 09:30:31 mrblack usb 2-2: device descriptor read/64, error -71
Jul 18 09:30:31 mrblack usb 2-2: new full speed USB device using uhci_hcd and address 53
Jul 18 09:30:31 mrblack usb 2-2: device descriptor read/64, error -71
Jul 18 09:30:31 mrblack usb 2-2: device descriptor read/64, error -71
Jul 18 09:30:31 mrblack usb 2-2: new full speed USB device using uhci_hcd and address 54
Jul 18 09:30:32 mrblack usb 2-2: device not accepting address 54, error -71
Jul 18 09:30:32 mrblack usb 2-2: new full speed USB device using uhci_hcd and address 55
Jul 18 09:30:32 mrblack usb 2-2: device not accepting address 55, error -71
Jul 18 09:30:32 mrblack hub 2-0:1.0: unable to enumerate USB device on port 2


do i need to do anything at the kernel level or elsewhere to get the system to recognize this device?

when i run openocd, i see this:
Code:
[ root@mrblack  9:28AM ]~$ openocd -f /usr/lib/openocd/interface/jlink.cfg -f /usr/lib/openocd/target/stm32.cfg
Open On-Chip Debugger 0.1.0 (2009-07-18-09:27) Release


BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS


$URL: https://kc8apf@svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.1.0/src/openocd.c $
Error: No valid jtag interface found (jlink)
Error: compiled-in jtag interfaces:
Error: 0: parport
Error: 1: ft2232
Error: 2: amt_jtagaccel
Error: 3: gw16012
Error: 4: usbprog
Runtime error, file "/usr/lib/openocd/interface/jlink.cfg", line 2:


any ideas?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54588
Location: 56N 3W

PostPosted: Sat Jul 18, 2009 7:04 pm    Post subject: Reply with quote

barfo,

We need the devices Vendor and Device IDs which you can get from lsusb, to determine linux support and kernel options.
If you can't spot it in lsusb, please post your entire /proc/bus/usb/devices, when the device is connected.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
barfo
Apprentice
Apprentice


Joined: 04 Mar 2006
Posts: 163

PostPosted: Sun Jul 19, 2009 3:07 pm    Post subject: Reply with quote

thanks for asking - here's more info...

i found out that this is not an ftdi device as i'd assumed. after opening the box i found it's a segger jlink device. some other posts i found trying to solve this led me to believe it had an ftdi rs232/usb interface. anyway - here is the output of lsusb:
Code:
~$ lsusb
Bus 001 Device 003: ID 0bc2:3001 Seagate RSS LLC
Bus 001 Device 001: ID 1d6b:0002 
Bus 005 Device 001: ID 1d6b:0001 
Bus 002 Device 001: ID 1d6b:0001 
Bus 003 Device 001: ID 1d6b:0001 
Bus 004 Device 001: ID 1d6b:0001 


what's really troubling is that i have downloaded and tried their (segger's) beta linux software to interface this programmer (jlink commander: [link]http://www.segger.com/download_jlink.html[/link]) and observed the following weirdness...

when i run ./start using their software, i see it detect the jlink device and i can querey it and read the target st7 device's memory. i wasn't able to write to it - i could issue a write command and it seemed happy with the exchange, but reading the memory address i attempted to write showed FFFF - not the value written. i have been able to power on/off the target and such through - so there is some functionality.

however - after running this software once, if i stop the session and disconnect the jlink programmer and reconnect it, it doesn't work. the led on the programmer just blinks, the software from segger cannot identify the programmer/jtag interface and lsusb takes forever to show any information. i see nothing related in dmesg or /var/log/messages however and i see no tasks running that i'd suspect to cause a problem. i rebooted out of curiousity and behold - the jlink device and segger's software worked again, but only once. after a dis/connect, it failed again.

i have been able to interface this device and target on a windows machine however using segger's software. i haven't tried anything more because i'd likely have to use IAR and i hate that environment so haven't gone through the bother to set it up.

i can't provide output from the segger software at the moment because i haven't rebooted and don't really want to... any pointers to where i should look to find the cause of this usb dis/connect, broken communication issue? it seems like the device epxects to sync with a service on the pc and for whatever reason that service hangs or dies and i can't restart it. segger/s software doesn't seem to do that for me.

thanks for any feedback everyone. i know this is a handful of problems rolled into a single thread - sorry about that. i'll register over at segger's forums and see what they have to say too.

--edit--
after a reboot i'm able to run a decent `lsusb -v` and i get the following for the device in question:
Code:
Bus 002 Device 002: ID 1366:0101 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x1366
  idProduct          0x0101
  bcdDevice            0.01
  iManufacturer           1 SEGGER
  iProduct                2 J-Link
  iSerial                 3 123456
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0001
  Self Powered


when i run their software:
Code:

/usr/src/openocd/jlink$ ./start
SEGGER J-Link Commander V4.03a ('?' for help)
Compiled Feb  2 2009 11:34:21
DLL version V4.03a, compiled Feb  2 2009 11:34:13
Firmware: J-Link ARM V6 compiled Jun 30 2009 11:04:04
Hardware: V6.00
S/N : 156000194
OEM : IAR
VTarget = 3.280V
Info: TotalIRLen = 9, IRPrint = 0x0011

WARNING: Identified core does not match configuration. (Found: Cortex-M3, Configured: None)
Info: Found Cortex-M3 r1p1, Little endian.
Info: TPIU fitted.
Info:   FPUnit: 6 code (BP) slots and 2 literal slots
Found 2 JTAG devices, Total IRLen = 9:
 Id of device #0: 0x3BA00477
 Id of device #1: 0x16410041
Cortex-M3 identified.
JTAG speed: 5 kHz
J-Link>


so i suppose the question has evolved into:
has anyone here used this device and a complimentary toolchain to develop for an st7 (cortex m3) target?? if so, i'd love some pointers![/b]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54588
Location: 56N 3W

PostPosted: Sun Jul 19, 2009 3:28 pm    Post subject: Reply with quote

barfo,

It looks like you need to follow http://lists.berlios.de/pipermail/openocd-development/2009-April/005569.html
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
barfo
Apprentice
Apprentice


Joined: 04 Mar 2006
Posts: 163

PostPosted: Sun Jul 19, 2009 11:21 pm    Post subject: Reply with quote

thanks neddy! i'll follow that...

as a rather open ended question - are there developers out there in the gentoo community developing on these st7 processors? specifically the cortex-m3?

i'm in up to my nose and it'd be greatly appreciated if someone could point me to a howto regarding a crossdev setup for this target. i've been looking high and low and it doesn't look simple. i'm tempted to toss the board in the closet and build another AVR board.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54588
Location: 56N 3W

PostPosted: Wed Jul 22, 2009 8:03 pm    Post subject: Reply with quote

barfo,

Join #gentoo-embedded on irc.freenode.net and ask there.
They will know whats going on with crossdev.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum