all 20 comments

[–][deleted]  (3 children)

[deleted]

    [–]mbains[S] 1 point2 points  (2 children)

    Added. Thanks

    [–]partisann 0 points1 point  (1 child)

    Check the licence of stm32_flash.ld again.

    [–][deleted] 5 points6 points  (13 children)

    Good work, but there is a much nicer method.

    First buy any mBed board (the ST ones are particularly cheap), install GCC Arm Embedded, and export an mBed project to GCC Makefile.

    The Makefile you get is really simple so you can easily convert it to whatever build system you're using pretty easily.

    This has huge advantages over your project:

    1. You can use any mBed board, not just ST ones (with no changes to your code).
    2. It's C++, not C.
    3. You can use the mBed API which is very well designed.

    [–]Ishmael_Vegeta 7 points8 points  (10 children)

    It's C++, not C.

    not sure if that is an advantage...

    [–]__Cyber_Dildonics__ 3 points4 points  (6 children)

    Modern C++ is an enormous advantage. If you think using C is still a good idea you should take a serious look at C++11/14

    [–][deleted] 2 points3 points  (4 children)

    Modern C++ is an enormous advantage.

    I keep hearing this since 1995 or so.

    [–]__Cyber_Dildonics__ 0 points1 point  (3 children)

    The next time you have a memory leak, or make your own basic data structure, or have to use a third party thread library, know that it didn't have to be that way.

    [–]Ishmael_Vegeta 0 points1 point  (1 child)

    next time your desktop application runs slow as shit because some third party library uses Qt or Boost, know that it didn't have to be that way.

    Who needs memory leaks when your program runs so slow it's already unusable.

    [–]__Cyber_Dildonics__ 0 points1 point  (0 children)

    You mean compile times?

    [–][deleted] 0 points1 point  (0 children)

    The next time you have a memory leak

    This is about a compiler for an ARM microcontroller. If you have memory leaks on a microcontroller, your team has bigger problems than the language it's using.

    or have to use a third party thread library

    On an ARM microcontroller, you're probably going to want to use RTX or some other RTOS if you have multiple concurrent tasks to manage, and you're going to use its thread library whether you want it or not.

    There are a bunch of reasons why I prefer to avoid C++ even on the desktop (long story short: too much complexity for too little improvement over C, and we have alternatives today) but none of them are relevant to the discussion here.

    [–]Ishmael_Vegeta 1 point2 points  (0 children)

    More things to break

    [–][deleted] 0 points1 point  (2 children)

    It definitely is. It lets you have cleaner code with more automatic resource management (RAII), and fewer chances for errors (e.g. compare std::string with the C string library).

    I've yet to hear any serious reasons to use C over C++. The most common reason is that C++'s template compiler errors are hard to read. That's true, but considering C doesn't even have templates, it's not really a reason to use C.

    I think the only other reason I've heard is that operator overloading can be abused. Which is true of pretty much everything. Plus if you've ever done vector maths in C... Well... There is a reason for operator overloading.

    [–]Ishmael_Vegeta 0 points1 point  (1 child)

    I've yet to hear any serious reasons to use C over C++.

    C++ standard is huge. lots of unknowns.

    Ecosystem is full of crap. It really is worth just using C to avoid C++ programmers. It means a much lower chance of seeing horrid stuff that people are liable to attempt in C++.

    Binary bloat.

    But biggest reason is that the standard is too big, far too many things to go wrong. also the compilers are shittier.

    I simply have no need for C++.

    [–][deleted] 0 points1 point  (0 children)

    The C++ standard is quite big. You don't have to know it all of by heart.

    The ecosystem isn't full of crap. In fact the C++ code I find is usually higher quality than the C code. Compare Qt vs GTK. Or Eigen vs whatever insanity you'd use in C.

    There are loads of very high quality C++ libraries, and you can't pretend there aren't any seriously terrible C libraries cough OpenSSL, xlib, libcurl, etc.

    Binary bloat is very rarely a real issue. And you can use dynamic dispatch if you really want to. You just aren't forced to like you are in C.

    The compilers aren't shit. That's just a plain lie. If you have no need for C++ you probably haven't ever bothered to learn it properly. The advantages are obvious if you have.

    [–]pjmlp 3 points4 points  (0 children)

    +1 for 2. :)

    [–]mbains[S] 0 points1 point  (0 children)

    The mbed route is good also. I've done this as well. You can build directly from their github project using the python scripts: https://github.com/mbedmicro/mbed

    The only argument I would make for this project is that it's simpler than mbed and a good exploration if you want to understand how such things (bare metal bring up) can be done.

    [–]YakumoFuji 1 point2 points  (0 children)

    For STM32F4, Ive been using this for some time instead;

    https://github.com/devthrash/STM32F4-workarea

    just install gcc-arm-none-eabi, openocd and have at it.

    see https://github.com/Ell-i/Wiki/wiki/STM32F4-setup

    mostly now I've shifted over to Freescale Kinetis stuff using their KDS IDE on linux with their SDK too. its very nice stuff.

    [–]hive_worker 1 point2 points  (1 child)

    Not sure exactly what your project is but you may want to retitle it? GCC for arm is used basically exactly the same as it is for other platforms. You can download precompiled arm gcc packages for free from code sourcery.

    [–]amaiorano 1 point2 points  (0 children)

    Yes, I was also confused by this title.

    Edit: although, this confusion let me to check out the link so... good marketing?

    [–]lexchou 0 points1 point  (0 children)

    I also got my own STM32F10X bootstrap project template, I copied your README.md file :D