Hi,
I added -Werror to the Makefile and I noticed these (I'm building for 328p):
Compiling C: ../ChibiOS/os/rt/src/chstats.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -O2 -funsigned-char -fdata-sections -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -Werror -Wunreachable-code -Wsign-compare -Wa,-adhlns=./../ChibiOS/os/rt/src/chstats.lst -I../ChibiOS/os/common/ports/AVR -I../ChibiOS/os/common/ports/AVR/compilers/GCC -I../ChibiOS/os/rt/include -I../ChibiOS/os/common/oslib/include -I../ChibiOS/os/hal/include -I../ChibiOS/os/hal/osal/rt -I../ChibiOS/os/hal/ports/AVR -I../ChibiOS/os/hal/boards/SPARKFUN_PRO_MICRO -I../ChibiOS/os/license -I../ChibiOS/os/various -I../lib -I../lib/motors -std=gnu11 -MMD -MP -MF .dep/chstats.o.d ../ChibiOS/os/rt/src/chstats.c -o ../ChibiOS/os/rt/src/chstats.o
In file included from ../ChibiOS/os/rt/include/ch.h:81:0,
from ../ChibiOS/os/rt/src/chthreads.c:51:
../ChibiOS/os/rt/src/chthreads.c: In function 'chThdCreateSuspendedI':
../ChibiOS/os/common/ports/AVR/chcore.h:265:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
tp->ctx.sp->r2 = (uint8_t)(pf); \
^
../ChibiOS/os/rt/src/chthreads.c:190:3: note: in expansion of macro 'PORT_SETUP_CONTEXT'
PORT_SETUP_CONTEXT(tp, tdp->wbase, tp, tdp->funcp, tdp->arg);
^
../ChibiOS/os/common/ports/AVR/chcore.h:267:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
tp->ctx.sp->r4 = (uint8_t)(arg); \
^
../ChibiOS/os/rt/src/chthreads.c:190:3: note: in expansion of macro 'PORT_SETUP_CONTEXT'
PORT_SETUP_CONTEXT(tp, tdp->wbase, tp, tdp->funcp, tdp->arg);
^
../ChibiOS/os/common/ports/AVR/chcore.h:270:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
tp->ctx.sp->pch = (uint8_t)_port_thread_start; \
^
../ChibiOS/os/rt/src/chthreads.c:190:3: note: in expansion of macro 'PORT_SETUP_CONTEXT'
PORT_SETUP_CONTEXT(tp, tdp->wbase, tp, tdp->funcp, tdp->arg);
^
../ChibiOS/os/rt/src/chthreads.c: In function 'chThdCreateStatic':
../ChibiOS/os/common/ports/AVR/chcore.h:265:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
tp->ctx.sp->r2 = (uint8_t)(pf); \
^
../ChibiOS/os/rt/src/chthreads.c:358:3: note: in expansion of macro 'PORT_SETUP_CONTEXT'
PORT_SETUP_CONTEXT(tp, wsp, tp, pf, arg);
^
../ChibiOS/os/common/ports/AVR/chcore.h:267:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
tp->ctx.sp->r4 = (uint8_t)(arg); \
^
../ChibiOS/os/rt/src/chthreads.c:358:3: note: in expansion of macro 'PORT_SETUP_CONTEXT'
PORT_SETUP_CONTEXT(tp, wsp, tp, pf, arg);
^
../ChibiOS/os/common/ports/AVR/chcore.h:270:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
tp->ctx.sp->pch = (uint8_t)_port_thread_start; \
^
../ChibiOS/os/rt/src/chthreads.c:358:3: note: in expansion of macro 'PORT_SETUP_CONTEXT'
PORT_SETUP_CONTEXT(tp, wsp, tp, pf, arg);
^
Assuming the upper byte is empty and can be disregarded, this patch fixes the warning.
Size cast errors in the AVR port Topic is solved
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: Size cast errors in the AVR port
Hi,
Just a confirmation, that I have the same warning, when I use trunk to build for MEGA2560.
But the warning disappear when I use ChibiOS_16.1.5.
Just a confirmation, that I have the same warning, when I use trunk to build for MEGA2560.
But the warning disappear when I use ChibiOS_16.1.5.
regards,
Theo.
Theo.
-
- Posts: 359
- Joined: Sat Jan 07, 2012 6:22 pm
- Location: Brazil
- Has thanked: 1 time
- Been thanked: 20 times
- Contact:
Re: Size cast errors in the AVR port
Patch applied! Btw, it only fixes the warnings for two-byte sized PC AVRs (which excludes basically the ATmega2560). I will check that one tomorrow and re-apply the changes on it.
Cheers,
Fabio Utzig
Cheers,
Fabio Utzig
Re: Size cast errors in the AVR port
utzig wrote:Patch applied! Btw, it only fixes the warnings for two-byte sized PC AVRs (which excludes basically the ATmega2560). I will check that one tomorrow and re-apply the changes on it.
Cheers,
Fabio Utzig
Yes, probably I left that out, sorry. As I wrote in another post, I use only 328p, so that's the only target I could test.
-
- Posts: 359
- Joined: Sat Jan 07, 2012 6:22 pm
- Location: Brazil
- Has thanked: 1 time
- Been thanked: 20 times
- Contact:
Re: Size cast errors in the AVR port
I applied the changes also for 3-byte PC models (aka ATmega2560).
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: Size cast errors in the AVR port Topic is solved
Hi,
I just made the test with my arduino mega (2560), every thing is fine for me.
Thanks the great job .
I just made the test with my arduino mega (2560), every thing is fine for me.
Thanks the great job .
regards,
Theo.
Theo.
Who is online
Users browsing this forum: No registered users and 28 guests