0

I've been asked to do a small project using an Ada BlueFruit board. It has a ATMega32U4. The 32U4 comes from the factory with a bootloader pre-installed. I've never used an Arduino before, but I have used AVR a bit in the past. Is the Arduino bootloader actually the one that came pre flashed from the factory? Does it even matter if it's the same bootloader as far as Flip is concerned?

Can I use the Flip batchisp utility to load my application code? We don't have a programmer handy and I don't want to muck up the bootloader on the board.

It's my understanding that the Arduino IDE tool chain does a bit of preprocessing "behind your back". I'd much rather continue writing straight AVR code in Atmel Studio. Is there anything I need to take into account when writing my application code? For example, do I need to do anything when compiling my app code, or when uploading it, to ensure it doesn't try to write to the memory addresses in the bootloader's range?

  • I don't really see what this is to do with the Arduino. You are asking about using a non-Arduino and not using the Arduino IDE. – Nick Gammon Aug 12 '16 at 0:43
  • Doesn't have anything to do with Arduino? The AdaFruit uses the Arduino software. learn.adafruit.com/adafruit-feather-32u4-basic-proto – RubberDuck Aug 12 '16 at 0:46
  • I think you are talking about the "Bluefruit LE Micro" board. Please note, Adafruit has several products called Bluefruit! So I think you are confusing people here. And getting answers that may not be what you want. Bottom line, (I think) you are "re-inventing the wheel". If you go this alone (do bare-metal-programming or Atmel-boot-loader based development) you may have problems using the Adafruit Arduino libraries for their Bluetooth module soldered on this board. – st2000 Aug 12 '16 at 2:44
  • The AdaFruit uses the Arduino software. - yes but the OP said s/he did not want to use the IDE. So the question was basically "how do I upload a .hex file to a ATMega32U4?". – Nick Gammon Aug 12 '16 at 2:54
  • I think the OP is giving up a lot of working-out-of-the-box code (Arduino-Adafruit Bluetooth libraries that I linked to) that he/she will have to port to the new IDE/SDK they pick. ... So, what the OP's question boils down to is can they use FLIP instead? Maybe. There's nothing special about the Arduino boot loader. But it is likely you will have to program the Atmel with a real Atmel programmer or use a 2nd Arduino as discussed in this thread. – st2000 Aug 12 '16 at 3:17
1

Is the Arduino bootloader actually the one that came pre flashed from the factory?

You would have to ask Adafruit that.

It's my understanding that the Arduino IDE tool chain does a bit of preprocessing "behind your back". Is there anything I need to take into account when writing my application code?

The things you are talking about is generation of function prototypes, that sort of thing. It's nothing you really need to worry about.

For example, do I need to do anything when compiling my app code, or when uploading it, to ensure it doesn't try to write to the memory addresses in the bootloader's range?

No, it would be crazy for the IDE to overwrite the bootloader. Then you wouldn't be able to use it again. In fact, to change the bootloader needs special hardware. You need to connect a programmer to the ICSP pins.


I just want to know if I need to do anything special during linking to ensure there's no memory address conflicts

I doubt you need to worry about that, as long as you ensure that whatever tool you are using knows to allow room for the bootloader.

and if I can use the Flip tool to upload

I don't see why not. Or you could use the dfu-programmer as I describe in my post How to flash the USB chip on the Arduino Uno.

  • 1
    I should have been more explicit. I don't want want to use the Arduino "IDE". I can compile my C code to a hex. I just want to know if I need to do anything special during linking to ensure there's no memory address conflicts and if I can use the Flip tool to upload. – RubberDuck Aug 12 '16 at 0:26
  • See amended reply. – Nick Gammon Aug 12 '16 at 0:42
2

I'd much rather continue writing straight AVR code in Atmel Studio.

The Arduino IDE allows you be lazy about #includes and forward references to functions, but it won't get in your way if you choose to write correct code.

I write standard C/C++ and switch back and forth between Eclipse (no over-helpful pre-processing) and the Arduino IDE. The Arduino IDE knows better; it just CYA (covers your assumptions :) in case you don't.

1

Arduino uses a different (second) bootloader, next to the DFU one that build into the 32u4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.