possible to decompile hex files? id like modify TK's firmware to increase PWM

rookie here, I see a lot of her .hex files but those appear to be already compiled and there is no way to decompile them, how can I read some of the code she’s already compiled for a flashlight?

https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/view/head:/ToyKeeper/spaghetti-monster/anduril/anduril.c

ToyKeeper’s repository has all the source code.

You’ll need to download all of the relevant .h and .c files, then use something like Atmel Studio to make changes before compiling your own .hex file.

This thread and this thread are good places to start if you haven’t done this before.

I make a few small tweaks to Andúril and compile .hex files for lots of my lights. TK’s code is nicely commented and easy to follow. I can fumble my way through it with very little prior programming experience. :slight_smile:

thanks! let me try it out!

curious, why does this only show PWM? ~toykeeper/flashlight-firmware/trunk : contents of ToyKeeper/spaghetti-monster/anduril/cfg-fw3a-219.h at revision 250

You’re viewing a single .h file.

When you compile Andúril, it references a dozen or more files like that to build your .hex file that’s ready to flash to your driver.

ahhh ok i see!

Are you using a Windows PC?

You need to have all of the files in this directory and in the anduril directory in one folder on your computer.

You’ll then use Atmel Studio to make changes to the anduril.c file, and perhaps some of the other files.

To get your feet wet, look at the anduril.c file here and gloss over it and TK’s comments.

Thanks! I got virtual box and threw on centos. I appreciate you for chiming in. I think it makes a little sense now with what you showed me so far.

Any chance you could provide some more detailed info on how to compile the files into a .hex in Atmel Studio?

I’ve made my changes to the anduril.c file using Xcode, but I’m struggling to figure out how to get everything into Atmel Studio and go from there to a new .hex

I dont use amtel, I use gcc command on linux to compile hexs

From your mention of “Xcode” it sounds like you are using a Mac. I’m not 100% (because I use a linux machine for compiling), but you may be able to install the necessary components like gcc on your Mac with Homebrew. If you have the prerequisites installed (I think there is a document in ToyKeeper’s repository that tells you how to set up your environment) TK has provided build scripts that do most of the work.

I’m at work right now, so I don’t have time to look all that up… but maybe this will help you get started.

I’m on a Mac but I’ve got Atmel Studio 7 running on a Windows partition as well.
I’ve got what seem to be all the necessary files open in Atmel Studio (pretty much following this guide: How-To: D4 with Anduril + Aux support (windows) but without the aux LED code), I’ve renamed anduril.c to main.c, and I’ve defined my config file and attiny 85 in main.c but when I go to build I still get about 30 errors. I’m not sure what else I’m missing.

I’m away from my desktop PC with all of my notes, but I ran into a long string of errors a while back.

It was due to a typo I made in the line that specifies which driver to build for.

See my post here, and TK’s helpful post just after.

There is also a reference in that thread for setting compile option for optimize for size. Wont work otherwise

Not using a mac but my Atmel Studio how to and Atmel projects are in my topics shared

These are the sort of errors I’m getting. Not exactly sure where these are coming from since I definitely have defined attiny 85 in main.c/tk-attiny.h etc.

I am able to compile a .hex with no errors from your Atmel Project folder, and I can’t find any glaring differences between my files and yours so I’m still pretty puzzled about the source of the errors.

I’ve never used amstel studio but from how I perceive your errors, you may not be loading the root directory.

Does amtel studio need some sort of project directory?

seems major information about the used MCU is missing
did you start the project with Attiny 85 chip?
copied all files from trunk in folder?

Well I finally got it working, it seems the answer was to remove most of the files except for these ones (thanks Lexel :slight_smile: ) from the main folder in solution explorer so that they exist only in the dependencies group. Not entirely sure why that was causing an issue, but at least it’s sorted and working now.