Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
How to exclude unused functions
joneewheelock:
--- Quote from: BlueHazzard on November 21, 2016, 07:04:20 pm ---
Beside from the garbage collection compiler switches Codeblocks has an embedded template (wizard script) for avr. Why are you not using this? From there i have the lss command line ;)
--- End quote ---
Compared to Atmel Studio, Codeblocks is very fast. I felt codeblocks very good barring few issues. But I do not think AVR template is completely usable. Even in AVRFreaks I saw some comments about this usage issues. I myself struggled to build with default settings and now comfortable to some extent. I hope someone will update the template. The issues I had faced are:
Codeblocks makes use of WINAVR2010. There is a latest tool-chain available from atmel and it should be used for addressing few issues.
-std=gnu99 is not by default.
-ffunction-sections -fdata-sections is not by default.
size option is not by default.
.lss is not getting generated even if we opt for that
There are few other default settings that could be set in the avr template I guess.
I will be very happy to see updated CB template.
stahta01:
Do you know the difference between an CB Wizard and a CB Template?
Edit: Because I have no idea if your issues is with the CB Wizard or with a CB Template!
Tim S.
BlueHazzard:
I think we are interested to help and make the wizard as usable as possible, so lets please work on this:
It is a long time since i last developed for AVR so i need some refreshing:
--- Quote ---Codeblocks makes use of WINAVR2010. There is a latest tool-chain available from atmel and it should be used for addressing few issues.
--- End quote ---
Codeblocks does not come with any compiler/library so where is the difference on USING the newer compiler? Do you mean the auto detection of the compiler?
I know there are problems with the fuses, so have you some tips how fuses work on the new compiler?
--- Quote ----ffunction-sections -fdata-sections is not by default.
--- End quote ---
Can be added, but i don't think this is a good idea, i mean you develop on a 8 bit controller with no memory. You should know what the thing do. If you let it up to the compiler to remove functions you don't use, why not remove them from the code. If you only code without thinking about optimization and relay only on the compiler to do the work you end with this shitty coded phone apps ;). But as i noted at the beginning, this could be added.
--- Quote ---size option is not by default.
--- End quote ---
Is easy to change. Can be done
--- Quote ---.lss is not getting generated even if we opt for that
--- End quote ---
The command line I gave you is the exact same as generated by the wizard, so i don't know why this does not work. The biggest problem with the actual implementation is that it can't be used platform independent. But this can be fixed...
--- Quote ---There are few other default settings that could be set in the avr template I guess.
--- End quote ---
Can you please elaborate? As I/we are really interested to fix this
greetings
oBFusCATed:
joneewheelock: The wizard is a simple squirrel script that anyone can edit. When you're finished you can propose patches.
joneewheelock:
--- Quote from: BlueHazzard on November 23, 2016, 01:55:58 pm ---I think we are interested to help and make the wizard as usable as possible, so lets please work on this:
--- End quote ---
I really appreciate the support. It will help new uses like me. I am not expert. So definitely there are some issues in my explanation earlier or below.
--- Quote ---Codeblocks does not come with any compiler/library so where is the difference on USING the newer compiler? Do you mean the auto detection of the compiler?
--- End quote ---
Yes, I mean default compiler now must be changed to latest one. If there is a plugin, it would be better so that compiler is also installed after installing CB.
Also please exclude selecting fuse.c. I do not know much about it. But I usually exclude that.
The biggest problem is adding new tool for programming and getting it working. The moment we add a tool such as AVRdude+Arduino, I get below error message. I have to change in post build settings every time I create a new project. This is what my major headache. It will be very good if you can add a wizard to add programming tools with USBASP and Arduino UNO options. Arduino is the big market and if some plugins can be added so that arduino code can be directly run after the installation, it might click. Biggest problem with arduino is very bad IDE.
Attached is the instructions I prepared for setting up codeblocks. You may understand few issues from this. Today when I tried, lss file and size information was getting generated. Let me try this with fresh CB installation and see. I had issues even if they were selected in wizard. Need to duplicate the problem and update you after a week or so.
Error message when burning (Refer post build settings in the instructions attached to fix the problem)
Tool execution terminated with status 1
Launching tool 'nano': C:\Atmega\programmers\avrdude\avrdude.exe -C"C:\Atmega\programmers\avrdude\avrdude.conf" -patmega328p -carduino -PCOM4 -b57600 -Uflash:w:tempPrj.elf.hex (in C:\temp\tempPrj\Debug)
stderr>
stderr> avrdude.exe: AVR device initialized and ready to accept instructions
stderr>
stderr> Reading | ################################################## | 100% 0.00s
stderr>
stderr> avrdude.exe: Device signature = 0x1e950f
stderr> avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
stderr> To disable this feature, specify the -D option.
stderr> avrdude.exe: erasing chip
stderr> avrdude.exe: reading input file "tempPrj.elf.hex"
stderr> avrdude.exe: error opening tempPrj.elf.hex: No such file or directory
stderr> avrdude.exe: input file tempPrj.elf.hex auto detected as invalid format
stderr> avrdude.exe: can't open input file tempPrj.elf.hex: No such file or directory
stderr> avrdude.exe: read from file 'tempPrj.elf.hex' failed
stderr>
stderr> avrdude.exe done. Thank you.
stderr>
Tool execution terminated with status 1
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version