Error compiling librf24-bcm for Serial gateway directly to Rpi2
-
this is the error it spits:
error: invalid suffix "x" on integer constant bcm2835.h:350:28 note: in expansion of macro ‘BCM2835_PERI_BASE’
Well actually there are many erros, but all are the same. Looks like defining like this:
#define BCM2835_GPIO_PADS (BCM2835_PERI_BASE + 0x3000)
is causing some error.
Do you see anything wrong here?
-
There isn't anything wrong w/ the #define - it's where it's being used. The #define is just a text replacer - you'll have to check the bcm2835.h line 350 to see what's going on. I'm not sure why it would think the constant ends at the x but maybe seeing where it's being compiled in might help.
-
The define is the line 350 of bcm2835.h, that's why I was puzzled. I won't be able to have a look at it again until monday. I'll see where it's being used and get back with the observations.
Thanks!
-
I also had this error when I did an update and upgrade on Pi. Try again with the downloaded image without update and upgrade.
-
@Viper_Scull said:
#define BCM2835_GPIO_PADS (BCM2835_PERI_BASE + 0x3000)
Shot in the dark: could be a matter of braces.
Try:#define BCM2835_GPIO_PADS ((BCM2835_PERI_BASE) + 0x3000)
-
@Yveaux said:
@Viper_Scull said:
#define BCM2835_GPIO_PADS (BCM2835_PERI_BASE + 0x3000)
Shot in the dark: could be a matter of braces.
Try:#define BCM2835_GPIO_PADS ((BCM2835_PERI_BASE) + 0x3000)
It doesn't work. Same errors.
The defines are used in bcm2835.c like this:
bcm2835_pads = (volatile uint32_t *)mapmem("pads", BCM2835_BLOCK_SIZE, memfd, BCM2835_GPIO_PADS);
A few more things:
·The compiler is called with these options:gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -mtune=arm1176jzf-s -march=armv7-a -D BCM2835_PERI_BASE=0x -c bcm2835.c
and in bcm2835.h we have:
#ifndef BCM2835_PERI_BASE #define BCM2835_PERI_BASE 0x20000000 #endif
I checked the Makefile to see the flags and:
CCFLAGS += -D BCM2835_PERI_BASE=0x${IOBASE}
So, if I'm not mistaken, it's not getting anything from $(IOBASE) and it's defining BCM2835_PERI_BASE as 0x, and that's what causes the compilation to fail, right?
Checking what IOBASE is we find :
IOBASE := $(shell cat /proc/iomem | grep bcm2708_vcio | cut -f 1 -d "-")
but in /proc/iomem there's no bcm2708_vcio. This is the result:
00000000-3affffff : System RAM 00008000-00775ccf : Kernel code 007de000-0092378b : Kernel data 3f006000-3f006fff : dwc_otg 3f007000-3f007eff : /soc/dma@7e007000 3f00b840-3f00b84e : /soc/vchiq 3f00b880-3f00b8bf : /soc/mailbox@7e00b800 3f200000-3f2000b3 : /soc/gpio@7e200000 3f201000-3f201fff : /soc/uart@7e201000 3f201000-3f201fff : uart-pl011 3f204000-3f204fff : /soc/spi@7e204000 3f300000-3f3000ff : /soc/mmc@7e300000 3f980000-3f98ffff : dwc_otg
Any ideas on this bcm2708_vcio??
-
I am having the same issue. Just with my old B version, but changing from Wheezy to Jessie image. It just worked when on wheezy..
-
Hi,
I had the same problem on my Raspberry Pi 2.
Maybe its not a very nice way but I just changed BCM2835_PERI_BASE=0x to BCM2835_PERI_BASE=0x3F000000 in the Makefile and now it works.
(On Raspi 1 it should be BCM2835_PERI_BASE=0x20000000)