Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
1
Using Code::Blocks / Re: new project wizard fails to locate glfw3.h
« Last post by Vigor on Today at 01:36:53 am »
Through trial and error, going down many rabbit holes, trying to understand the glfw3 project script I found a solution to the above problem.

I took the glfw3 folder with a copy of the glfw3.h file from my initial download and moved it until I found the right spot for it.   It goes in MinGW/Include/, so MINGW/Include/GLFW3/glfw3.h

Before trying this I tried to change the path in the script to where glfw3.h is and has been working for years but it didn't work.  In fact it still works for all of my old projects so there must be a better solution.

After completing the wizard I got a new project that doesn't complile.   It gives a lot of (i think) linking errors of undefined references such as

C:\Program Files\CodeBlocks\MinGW\lib/libglfw3.a(init.c.obj):init.c:(.text+0xb9): undefined reference to `__mingw_free'

In the above error line, one thing seems peculiar.   "MinGW\lib/libglfw3.a"  sometimes it is using forward slash and other times it is using backslash.    I have seen paths written with forward slashes or with back slashes but I think this is the first time I have ever seen a path written with a combination of forward and back slashes.

libglfw3.a is in the MinGW/LIB/ folder. (i didn't need to move it from where it has been for years)

I read a post on stack exchange which had an almost identical problem where it was determined that the original poster needed to update his GCC compiler.   I recently updated mine but I went ahead and updated it again and nothing changed.

Since I have two full installations of codeblocks on my computer, I wanted to try to start projects in both, then edit both scripts and compare them side by side looking for differences.   It wouldn't let me open both a once.  I can open one, then trying to execute the 2nd brings the window to the other to the front.

Is there a way to have 2 instances of codeblocks running at once?  It would often be useful if I could have multiple instances of codeblocks running at once.   It would be really great if each instance had a unique thumbnail and didn't stack in the taskbar.
2
Help / Re: Compiler Optimizations
« Last post by mikejp56 on Today at 01:17:25 am »
Hi stahta01,
I did try to build using the optimizations 01, 02, and 03 with no success.
I obviously fat fingered the F_CPU define. I will retry that again without the D! This code is for a crystal controlled clock running at 16MHz. It keeps correct time without the F_CPU define.
I realized afterward that it is a compiler issue when I compiled the same exact c code in MPLABX (which I really do not like) and got the same warning from the compiler.
Regards,
mikejp56
3
Help / Re: Compiler Optimizations
« Last post by stahta01 on Yesterday at 11:32:15 pm »
Hi stahta01,
I have set the compiler optimizations to 1, 2, and 3, but this issue still occurs. There was another post about using the compiler optimizations to solve an issue that I saw.
I just tried the same code with MPLABX with the same results, and the same warning message, so it doesn't appear to be a CB issue. I am just reaching out for help from people with way more experience than me.
Regards,
mikejp56

See https://www.nongnu.org/avr-libc/user-manual/group__util__delay.html

Did you define F_CPU as required?
Edit: You did as "-DF_CPU=16000000UL"

And, you need to find an website that supports your AVR compiler; because some or most of your question is off topic (OT) for this website.

Edit: Did you rebuild the project trying at least 3 different optimizations? Edit3: I suggest "O1" "O2" and "Og".
If yes, what optimizations did you try?
Post at least one build log of those opt. builds?

Edit2: Try building the project without the debug mode (-g) being used. Sometimes debug mode make things easier and sometimes harder.

Tim S.
4
Help / Re: Compiler Optimizations
« Last post by Miguel Gimenez on Yesterday at 11:20:36 pm »
Were optimizations enabled in the log you posted?
5
Help / Re: Compiler Optimizations
« Last post by mikejp56 on Yesterday at 08:56:08 pm »
Hi stahta01,
I have set the compiler optimizations to 1, 2, and 3, but this issue still occurs. There was another post about using the compiler optimizations to solve an issue that I saw.
I just tried the same code with MPLABX with the same results, and the same warning message, so it doesn't appear to be a CB issue. I am just reaching out for help from people with way more experience than me.
Regards,
mikejp56
6
Help / Re: Compiler Optimizations
« Last post by stahta01 on Yesterday at 08:46:25 pm »
https://www.avrfreaks.net/s/topic/a5C3l000000UUx7EAG/t132775

Over a decade old post; where user found problem in Code::Blocks global compiler settings.

Tim S.
7
Help / Re: Compiler Optimizations
« Last post by mikejp56 on Yesterday at 08:27:22 pm »
Hi Miguel,
Here is the text of the build log. From what I have read it appears to have something to do with compiler optimizations.
Thanks for your time.

-------------- Build: Debug in Binary_Clock_Mods (compiler: GNU GCC Compiler for AVR)---------------

avr-gcc -Wall -mmcu=atmega328p -DF_CPU=16000000UL -g  -c main.c -o obj/Debug/main.o
avr-gcc  -o bin/Debug/Binary_Clock_Mods.elf obj/Debug/fuse.o obj/Debug/main.o  -mmcu=atmega328p -Wl,-Map=bin/Debug/Binary_Clock_Mods.map,--cref 
In file included from main.c:18:0:
/usr/lib/avr/include/util/delay.h:112:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
 # warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
   ^
Output file is bin/Debug/Binary_Clock_Mods.elf with size 31.85 KB
Running project post-build steps
avr-objdump -h -S bin/Debug/Binary_Clock_Mods.elf > bin/Debug/Binary_Clock_Mods.lss
avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.hex
avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.eep
avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.lock
avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.sig
avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.fuse
srec_cat bin/Debug/Binary_Clock_Mods.fuse -Intel -crop 0x00 0x01 -offset  0x00 -O bin/Debug/Binary_Clock_Mods.lfs -Intel
srec_cat bin/Debug/Binary_Clock_Mods.fuse -Intel -crop 0x01 0x02 -offset -0x01 -O bin/Debug/Binary_Clock_Mods.hfs -Intel
/bin/sh: 1: srec_cat: not found
Process terminated with status 127 (0 minute(s), 0 second(s))
0 error(s), 1 warning(s) (0 minute(s), 0 second(s))
 

-------------- Build file: Debug in Binary_Clock_Mods (compiler: GNU GCC Compiler for AVR)---------------

Nothing to be done (all items are up-to-date).
8
Help / Re: Compiler Optimizations
« Last post by Miguel Gimenez on Yesterday at 07:45:58 pm »
9
Help / Compiler Optimizations
« Last post by mikejp56 on Yesterday at 06:34:52 pm »
Hi All,
I am using CB with Linux Mint 20. I get the following warning "/usr/lib/avr/include/util/delay.h:112:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
 # warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
I have set the compiler optimizations for 1, 2, and 3, but I still get the same warning.
I am pretty new to CodeBlocks and AVR programming.
Please point me in the correct direction.
Thanks for reading.
Regards,
mikejp56
10
General (but related to Code::Blocks) / Re: CB C++ Issue with GNU C++ 17 (ISO)
« Last post by sodev on Yesterday at 05:19:40 pm »
Good catch, the bots are getting smarter in hiding links.
Pages: [1] 2 3 4 5 6 ... 10