cancel
Showing results for 
Search instead for 
Did you mean: 

Debug without SWD/JTAG

leventeyigel52
Associate II
Posted on September 03, 2012 at 09:05

Hello everyone,

For a project, we try to debug STM32C-Eval board without SWD/JTAG standart board. We have an *.out file and we want to download this file. We want to implement a C/C++ program instead of SWD/JTAG. How can we do this? Does anyone have any document about C/C++ implemantation of SWD/JTAG?

Thank you...
9 REPLIES 9
domen23
Associate II
Posted on September 03, 2012 at 14:14

If you just want to upload firmware to the chip, then use one the built-in bootloader and appropriate software on PC, ie. stm32loader.

> We want to implement a C/C++ program instead of SWD/JTAG.

Apples and nuts. What?
leventeyigel52
Associate II
Posted on September 03, 2012 at 15:01

OK, I'm explaining the subject in more detail.

I have an *.out file which creates in IAR Embedded Workbench. I want to download this file into STM32 microcontroller. But not using IAR Embedded Workbench. Because I won't download code into STM32 microcontroller. You think that is mass production. Because of code security 🙂 

I think I prepare a computer program which is in C/C++/C#. After that I choose an out file in PC and I download code through this program. In my opinion, I must know SWD/JTAG protocol and writes code in C/C++/C# programming language. 

How can I implement this kind of application?

Thank you...

frankmeyer9
Associate II
Posted on September 03, 2012 at 15:30

Sorry, but your post does still not make sense.

Because I won't download code into STM32 microcontroller. You think that is mass production. Because of code security 🙂

 

Of course you want to download code.

Otherwise you have no application on that board, and that stm32 controller !

Look up the ST specs. for readout protection, to protect the code AFTER it is downloaded into your controller.

If you can't trust your production personnel and need to protect the flashing process as well, you can go ahead and write an encrypted bootloader. And don't forget to protect all your PC-based production equipment from unauthorized access, too...

leventeyigel52
Associate II
Posted on September 03, 2012 at 16:14

I want to write a program in C/C++/C# programming language. This program will read *.out file and  according to *.out file, will send data microcontroller's programming port through computer's serial port. 

frankmeyer9
Associate II
Posted on September 03, 2012 at 16:29

I want to write a program in C/C++/C# programming language.

 

And so what ?

This program will read *.out file ... will send data microcontroller's programming port

 

The only ''programming port'' of an ARM Cortex, including the STM32, is JTAG/SWD.

Better get some stm32 reference manuals, especially those about Flash programming.

leventeyigel52
Associate II
Posted on September 03, 2012 at 16:42

I want to write a program in C/C++/C# programming language.

 

And so what ?

I want to write a program in C/C++/C# programming language.Because while operator downloads the code, he/she musn't see our code.

 

Or dou you have any way how can download code with a computer program?

frankmeyer9
Associate II
Posted on September 03, 2012 at 17:01

I guess you look for an application to flash a STM32 in the production process, in an unattended manner, i.e. automatically. The folks from ST might help you in this case, my company does not yet use STM32 in products. I use the toolchain and the JTAG/SWD debug adapter to flash individual boards, from within the IDE.

You think that is mass production. Because of code security 🙂

 

 

You surely mean to protect the product AFTER it is programmed, and goes to the customer.

That is already designed into the product, search for ''readout protection''.

Setting some bits in the option bytes disables JTAG access to prevent readout and debugging.

Posted on September 04, 2012 at 22:14

Programming via SWD/JTAG is quite involved.

You could perhaps use library/dll software from Segger, or perhaps one of their Flasher ARM type products.

http://www.segger.com/flasher-arm.html

In terms of complexity, you could look a the system loader, you could inject a small amount of code into RAM and execute it. This applet could then pull an encrypted image onto the device and flash.

Most anything you do outside your control will have some vulnerabilities, if you can't trust your manufacturer you'd need to do the final programming yourself.

I'm not sure SWD/JTAG offers much protection from someone who can capture the bit stream.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
ashibakov
Associate II
Posted on September 05, 2012 at 20:14

One can also use USART1 and the built-in bootloader on stm32f1xxx series (see the flash programming manual). There is also open source software to do (which the gp can modify to his/her liking) this but I am not sure what the exact question is. The details of SWD/JTAG can be found in the reference manual if that is what is required but as someone has pointed out, writing your own JTAG programmer will be quite involved.