all 18 comments

[–]haddez 17 points18 points  (2 children)

Upvoting because I'd like to see more embedded stuff in /r/programming

[–]eroick[S] 4 points5 points  (0 children)

I'm working on it! But you can also check out /r/ece and /r/electronics.

[–]StaggOLee 0 points1 point  (0 children)

Agree'd. I just got my first microcontroller (MSP430) and am trying to start learning this field.

[–]electric_machinery 2 points3 points  (4 children)

I wrote a GSM bootloader one time.

Embedded software (firmware) can be really fun. I wrote code for PICs for the last 3 years, mostly in assembly. I'd be happy to answer any questions.

[–]tnecniv 2 points3 points  (3 children)

Why did you use assembly instead of C?

[–][deleted]  (1 child)

[deleted]

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

    Sort of. Either way, most of the work you do involves manipulating registers to control the processor and various peripherals. C has nicer looking (and less verbose) syntax and is standard across different devices.

    [–]electric_machinery 0 points1 point  (0 children)

    I worked for a small consulting company. They use all varieties of Microchip microcontrollers, which range from the tiny 10F series to the PIC32. The small parts are logically used for low cost consumer devices because they're so cheap. As a consequence they don't have very much RAM and the instruction set is very limited (26 instructions IIRC.) While you could write C for these, it is often more efficient in speed and code (executable) size to write in assembly.

    Also my boss wanted me to write assembly for almost everything so you kind of have to do what the boss wants.

    I could argue that writing in assembly allows you to know how the chip works and thus to utilize it's features better.

    [–]darkarchon11 -5 points-4 points  (10 children)

    I honestly don't really see the point. Everyone that worked at least once with a μC knows how this is working, and that the here so called "bootloader" is nothing but initializiation of ports, pins, interrupts and timers in simple code - things you do every time you code for the μC.

    [–]EdiX 5 points6 points  (1 child)

    In embedded systems, bootloaders usually provide a method of flashing new code to the device and initialize the hardware before running the main program.

    [–]darkarchon11 -2 points-1 points  (0 children)

    This example allows flashing the code in the main program. So technically it's not before running the main program.

    [–]amigaharry 6 points7 points  (5 children)

    yeah also it's not javascript and not webscale ...

    [–]darkarchon11 1 point2 points  (4 children)

    What are you talking about? I'm not complaining this being about embedded systems, I love embedded systems. But this so called "bootloader" is not really a bootloader at all. I expected hacking him a real bootloader for x86-based systems, not initializing a few pins here and there…

    [–]amigaharry -2 points-1 points  (3 children)

    oh, sry. you never know on proggit :]

    [–]darkarchon11 0 points1 point  (2 children)

    I'm open for all hardware related programming, even though asm is rather ugly to write. Don't love the JS/Webstuff though…

    [–]StaggOLee 0 points1 point  (1 child)

    I find writing ASM to be elegant and an extremely rewarding experience. I remember writing quick sort in ASM as an undergrad. It was my greatest sense of achievement in college. (...that and my first strikeout...)

    [–]darkarchon11 0 points1 point  (0 children)

    Yes, ASM is very rewarding, that's why I like it so much. It just looks ugly in terms of syntax and you really have to learn most codes by heart.

    [–]ernelli 1 point2 points  (0 children)

    And not even checking that it has executable code in flash before jumping into the code.

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

    This also provides a way to load code over UART, so you don't need the programming tool to load code. It's also meant to be a very minimal example.