
Dash Hacking: Bare-Metal STM32 Programming - ptorrone
https://learn.adafruit.com/dash-hacking-bare-metal-stm32-programming
======
IshKebab
The title should reference the Dash really, since that is the interesting bit
here; not the STM32 stuff.

Anyway, if anyone is going to attempt this I would recommend:

1\. Don't install a VM to do this as weirdly recommended in the artcle. Using
GCC Arm Embedded on Windows is not difficult. There are pre-built binaries on
Launchpad which work fine.

2\. If possible, use the mBed API instead of any manufacturer-supplied SDKs.
It's a great API and supports many STM32 chips already (though apparently not
this specific one so some porting may be necessary).

3\. Good luck getting that broadcom wifi chip to work.

~~~
bcg1
I think doing it in a VM for this type of tutorial is not a bad decision.

We're at a point where you can't assume everyone uses Windows, and writing up
how to do this on every operating system would be a PITA I imagine.

As a GNU/Linux user I'm appreciative of this format because I can just
ignorant the vagrant stuff and get down to brass tacks.

------
bcg1
This is great. I just thinking about messing with a STM32 chip for a project,
so this guide looks good. And actually Amazon's little button thing looks
awesome.

Hopefully they don't freak out and try to lock it down in the future :( Since
Microsoft got pwned when they tried to mess with the Adafruit crew you'd think
they wouldn't, but I've learned that one should never underestimate the power
of human stupidity.

~~~
duskwuff
If you just want to get into development, ST's "Discovery" development boards
are really cheap -- like, $10 to $15. Highly recommended.

~~~
pantalaimon
It also runs Linux

[https://github.com/AdrianHuang/stm32f429-linux-
builder](https://github.com/AdrianHuang/stm32f429-linux-builder)

~~~
bcg1
Awesome, and thank you both :)

------
desdiv
Dumb question: why don't manufacturers disable the JTAG interface after all
the flashing and testing are done?

Don't get me wrong, I really appreciate them leaving these devices easily
reprogrammable for us hackers, but there's really not much benefit in it for
them.

~~~
stephen_g
Our company leaves them enabled 1) because it's not really worth the effort to
disable and 2) it's super handy if you get a product returned to re-flash it
if it's somehow been bricked!

~~~
m_eiman
We use NXP MCUs that have a few different code protection modes. The mode we
use in release code disables JTAG and Flash access, but allows erasing the
entire Flash. This makes it hard(er?) to read and modify our code, while still
allowing us to easily wipe a returned device and re-program it using a
suitable firmware image.

Selecting which mode to use is a simple matter of setting a specific value at
a specific position in the Flash image, very handy.

~~~
duskwuff
The STM32F2 MCU that Amazon used supports similar features; see section 2.6.3
of:

[http://www.st.com/web/en/resource/technical/document/program...](http://www.st.com/web/en/resource/technical/document/programming_manual/CD00233952.pdf)

In brief, though, the MCU can be put into "level 1" read protection which
limits the capabilities of a JTAG debugger, or "level 2", which fully protects
the device by disabling JTAG entirely. Given that Adafruit were able to
reprogram the device, Amazon must not have used level 2 protection.

------
gcb0
the amazon thing is not cheap. for 15 you get a Dev board with lots of handy
usb and serial ports. for 5 you get Chinese board with wifi that also have
stm32 chips

------
chatman
This seems like a great alternative to programming an ESP8266.

~~~
tdicola
Yeah if details of configuring the WICED SDK can be sorted out then it would
be a nice little wifi & internet connected board. You have to register an
account to download it but if you're curious the WICED SDK is here:
[http://community.broadcom.com/community/wiced-
wifi](http://community.broadcom.com/community/wiced-wifi)

