2012-09-03 12:05 AM
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...2012-09-03 5:14 AM
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?2012-09-03 6:01 AM
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...2012-09-03 6:30 AM
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...
2012-09-03 7:14 AM
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.
2012-09-03 7:29 AM
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.
2012-09-03 7:42 AM
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?
2012-09-03 8:01 AM
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.
2012-09-04 1:14 PM
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.2012-09-05 11:14 AM
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.