LoxLink icon indicating copy to clipboard operation
LoxLink copied to clipboard

Segger Embedded Studio for Arm

Open chrisrock1984 opened this issue 5 years ago • 68 comments

Hallo,

Habe versucht das Crossstudio Projekt nach Segger zu portieren. Leider bekomme ich ne Menge Linker Errors. Liegt wahrscheinlich daran, dass Crossstudio Datein benötigt werden.

Hat irgendjemand diese Portierung bereits erledigt? Andere Alternative, die frei verfügbar ist? Ich würde gerne, nach Ablauf der Evaluation Phase weiter am Code herumbasteln.

Danke!!

chrisrock1984 avatar Feb 03 '20 05:02 chrisrock1984

Die "CrossWorks Tasking Library" ist notwendig. Die kompiliert zwar auch unter Seggers (schließlich ist Segger nur eine rebranded Version von Crossworks), aber gehört soweit ich weiß, nicht dazu. Ich hatte unsprünglich mal FreeRTOS genommen, aber hatte ein paar Probleme und bin dann – wie Loxone anscheinend auch – auf die CTL gegangen.

sarnau avatar Feb 04 '20 15:02 sarnau

Hi, I understand German but writing is another thing... I'll answer in English if you don't mind.

@chrisrock1984 , did you make any progress porting this project to Segger? I'm stuck and making no progress on my own.

I extracted the missing "System Files" from the free version of CrossStudio and hand-linked the missings. I also added the environment variable "$(TargetDir)=/Users/...". Now I'm still facing some issues, one of them being that I can't find where to define the target to be used (#error target not defined). Full disclosure: I'm still waiting for my ST-link V2 to arrive so currently I'm trying to build without connecting to the STM32.

KjellVerb avatar Apr 19 '20 18:04 KjellVerb

Hi,

Did not make any progress so far ;(

Br

chrisrock1984 avatar Apr 19 '20 18:04 chrisrock1984

Apparently I needed to restart Segger in order to load the environment variable, now I got a bit further.

I had the "ctl_set_priority()"-error and solved it (I think) by adding "#define __CROSSWORKS_ARM". Now the project is completely building but fails at the end with the following error: "no linker script, memory map file or section placement segments specified" @sarnau , I'm not experienced in STM32 development so could you point me in the right direction please?

KjellVerb avatar Apr 19 '20 19:04 KjellVerb

That is the hardest part of getting the STM32 stuff running. I would suggest to create a trivial STM32 example with Segger and compare the project file with the crossworks one. They are almost identical, so you should be able to find what you need to adjust.

sarnau avatar Apr 19 '20 20:04 sarnau

Thanks for the hint, I think my setup is all OK now because I'm getting no more errors and the build completes. Now the real test will be when I get all the hardware for an actual setup.

KjellVerb avatar Apr 19 '20 20:04 KjellVerb

Is it possible to share the segger project files as I already have all the hardware ?! Really appreciate your work you have done!!

Thx

chrisrock1984 avatar May 02 '20 20:05 chrisrock1984

My hardware has arrived but unfortunately I'm still struggling. I'm able to start and stop the program with the debugger, but it won't run on it's own. This seems like another one of those weird STM32 things. Any suggestions on where to look?

@chrisrock1984 I'll try to retrace and write down my steps once everything is up.

KjellVerb avatar Jun 09 '20 14:06 KjellVerb

Turns out that the code crashed on debug_printf() :-) Time to comment all of those out or something.

KjellVerb avatar Jun 09 '20 15:06 KjellVerb

Another question that may or may not be related to the Segger porting: I'm currently debugging with an endless blinky loop running in LED.cpp. It seems like HAL_Delay() has an LSB delay value of 10ms instead of 1ms, is that expected behaviour in the LoxLink project or do I need more debugging to rectify this? system_init() has already been called so I do think that all of the config should have been done by the time I get into my infinite loop.

KjellVerb avatar Jun 09 '20 16:06 KjellVerb

Never mind that last question, I finally have a loxlink extension up and running on two different STM32 eval-boards. I'll try to retrace my steps in the coming days and will try to document the process.

KjellVerb avatar Jun 11 '20 20:06 KjellVerb

That would be great!!

chrisrock1984 avatar Jun 11 '20 20:06 chrisrock1984

@KjellVerb Is it possible that you share your running segger studio project?

challo2018 avatar Sep 03 '20 19:09 challo2018

@KjellVerb Is it possible that you share your running segger studio project?

That would be awesome ;)!!!

chrisrock1984 avatar Sep 03 '20 20:09 chrisrock1984

I'm not very eager to share the full project folder because

  1. it contains Crossworks libraries that I am not allowed to distribute
  2. it will not help you because you also need to change some other folders on your drive
  3. there are OSX specific references in the project

What I can share is the process of how I got it to work. I restarted from scratch and logged my steps, see attached. LoxLink2Segger.txt

KjellVerb avatar Sep 04 '20 05:09 KjellVerb

I'm not very eager to share the full project folder because

  1. it contains Crossworks libraries that I am not allowed to distribute
  2. it will not help you because you also need to change some other folders on your drive
  3. there are OSX specific references in the project

What I can share is the process of how I got it to work. I restarted from scratch and logged my steps, see attached. LoxLink2Segger.txt

GREAT!! works for me ;-) was able to compile. now I need to check if it works on silicon ;-) Thanks a lot for your work!!

chrisrock1984 avatar Sep 04 '20 09:09 chrisrock1984

You're welcome! @sarnau I think this one can be closed.

KjellVerb avatar Sep 04 '20 10:09 KjellVerb

just trying to follow these instructions using segger emedded studio for arm v5.34 64bit on windows..

I'm getting the following errors linking LoxLink.elf

Checking project status
Building ‘LoxLink’ from solution ‘LoxLink’ in configuration ‘Debug’
  Linking LoxLink.elf
    Output/Debug/Obj/LoxLink/STM32_ctl.o: in function `SysTick_Handler':
    undefined reference to `ctl_enter_isr'
    C:\Users\Davidw\AppData\Local\SEGGER\SEGGER Embedded Studio\v3\packages\targets/STM32/STM32_ctl.c:60: undefined reference to `ctl_exit_isr'
Build failed

Struggling a little with the config instructions possibly:

	- Correct memory map file
	- Correct DeviceVectorsFile under Project Macros
	- Correct target processor

Not sure what I need to do with these when using a STM32103VET..

Added #define __CROSSWORKS_ARM to system.cpp - correct? TargetsDir I've sorted..

Any suggestions welcome :)

davidwallis avatar Jan 21 '21 17:01 davidwallis

i am not sure if you struggling at the same point i did. i am also not sure if it is the easyest way i did, but this way it worked for me.

see this picture how i added _CROSSWORKS_ARM.

image

dimmu311 avatar Jan 21 '21 21:01 dimmu311

Bingo! That compiled..

Now need to to work out how to debug and program with the st-link v2

davidwallis avatar Jan 21 '21 22:01 davidwallis

Moin moin (greetings to Hamburg from another town at the river Elbe ;-) ), is it possible to debug the application via st-link v2 in segger embedded studio?

I could compile the code as it is and program it to an STM32F103VET6 eval board. But at first I'd like to check, what the code does and which GPIO are set. Markus, could you tell us, what else you have connected to your board.

The CAN bus control leds are external connected to B13, B14, right?. Is it also possible to use the leds on the eval board. In my case it should be E1 and E0.

image

Are there any other hints to start with your excellent reengineered work?

BR maik

MS-Astra avatar Feb 06 '21 11:02 MS-Astra

I am using a SEGGER J-Link PRO, which I found at eBay UK several years ago. So, debugging with that one is a non-issue. You can also flash a st-link v2 to a J-Link, which helps.

sarnau avatar Feb 06 '21 14:02 sarnau

I think only onboard st link can be flashed, not the usb dongle version??

On Sat, 6 Feb 2021, 14:53 Markus Fritze, [email protected] wrote:

I am using a SEGGER J-Link PRO, which I found at eBay UK several years ago. So, debugging with that one is a non-issue. You can also flash a st-link v2 to a J-Link, which helps.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sarnau/LoxLink/issues/9#issuecomment-774488898, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJWV7SSN5UVSGUCUPZXS2DS5VJVNANCNFSM4KO7II4Q .

davidwallis avatar Feb 06 '21 21:02 davidwallis

Thanks for your feedback. I think the SEGGER J-Link EDU MINI is for me the best option.

I tried the example (with the DI and relay extension) as it is, but the miniserver doesn't detect any extension. As I understood the legacy extensions doesn't need the AES keys. So this could not the reason that it doesn't work.

Both LED are blinking.

Any idea?

MS-Astra avatar Feb 08 '21 22:02 MS-Astra

@MS-Astra based on your comment, I bought the J-Link EDU mini - and glad I did as previously I was looking at the clones due to the cost.

Can confirm that this works fine, had to fiddle with a couple of options in the project to get it working, but can now debug..

Just need to get an CAN bus connection to my desk now and try and get a bit further.

davidwallis avatar Feb 11 '21 11:02 davidwallis

hey @davidwallis3101, sounds good. Please, let me know if you can run LoxLink (build with SEGGER) successful with the miniserver on a STM32 board.

MS-Astra avatar Feb 11 '21 12:02 MS-Astra

I'm connected the board to loxlink but not getting too far at the moment, need to try and find a schematic for the board I have which is

image

can then try and find out what LED is what, and that the two jumpers marked 0 and 1 are..

David

davidwallis avatar Feb 12 '21 12:02 davidwallis

image This is my board. Looks a little bit different and has no jumpers etc.

I got all information of my board from the seller as download link. So the data should be valid.

At the moment I have no idea why it isn't running. Maybe I can use the rs485 to print some debug output as long I have no real debugger...

MS-Astra avatar Feb 12 '21 17:02 MS-Astra

I'm connected the board to loxlink but not getting too far at the moment, need to try and find a schematic for the board I have which is

image

can then try and find out what LED is what, and that the two jumpers marked 0 and 1 are..

David

I started with the same board as you. The jumpers are for the boot mode of the stock boot loader of the stm32. if boot0 is set to 0 it does not matter what settings you have on boot1. when the two leds are blinking, the application is running, so you are not in the boot loader.

matlab22 avatar Feb 13 '21 17:02 matlab22

I've not got as far as blinking leds, any ideas what io is allocated to d2 and d3?

On Sat, 13 Feb 2021, 17:43 matlab22, [email protected] wrote:

I'm connected the board to loxlink but not getting too far at the moment, need to try and find a schematic for the board I have which is

[image: image] https://user-images.githubusercontent.com/13855486/107770906-e0f66000-6d31-11eb-88eb-4ab061f6ec26.png

can then try and find out what LED is what, and that the two jumpers marked 0 and 1 are..

David

I started with the same board as you. The jumpers are for the boot mode of the stock boot loader of the stm32. if boot0 is set to 0 it does not matter what settings you have on boot1. when the two leds are blinking, the application is running, so you are not in the boot loader.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sarnau/LoxLink/issues/9#issuecomment-778651620, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJWV7RP6Z4IC72S4AUA7TTS6224NANCNFSM4KO7II4Q .

davidwallis avatar Feb 13 '21 18:02 davidwallis