Latest SDCC

Post here to get support
Post Reply
sjw
Beginner
Posts: 3
Joined: Sun Jul 09, 2017 5:51 pm

Latest SDCC

Post by sjw »

Which SDCC should we be using?

I’ve used the latest snapshot from Sourceforge, sdcc-snapshot-universal-apple-macosx-20170709-9946.tar.bz2, and get several warnings:

Code: Select all

$ make CRPA=1
sdcc -Iinc/ --model-large --std-sdcc99 -DCRPA -c src/main.c -o bin/main.rel
sdcc -Iinc/ --model-large --std-sdcc99 -DCRPA -c src/radio.c -o bin/radio.rel
src/radio.c:365: warning 94: comparison is always false due to limited range of data type
sdcc -Iinc/ --model-large --std-sdcc99 -DCRPA -c src/usb.c -o bin/usb.rel
src/usb.c:49: warning 158: overflow in implicit constant conversion
src/usb.c:50: warning 158: overflow in implicit constant conversion
src/usb.c:567: warning 158: overflow in implicit constant conversion
src/usb.c:567: warning 158: overflow in implicit constant conversion
sdcc -Iinc/ --model-large --std-sdcc99 -DCRPA -c src/usbDescriptor.c -o bin/usbDescriptor.rel
sdcc -Iinc/ --model-large --std-sdcc99 -DCRPA -c src/led.c -o bin/led.rel
sdcc -Iinc/ --model-large --std-sdcc99 -DCRPA -c src/utils.c -o bin/utils.rel
sdcc --xram-loc 0x8000 --xram-size 2048 --model-large bin/main.rel bin/radio.rel bin/usb.rel bin/usbDescriptor.rel bin/led.rel bin/utils.rel -o bin/cradio.ihx
sdobjcopy -I ihex bin/cradio.ihx -O binary bin/cradio.bin
Crazyradio PA build 
which are all because the code uses e.g.

Code: Select all

static char radioChannel = -1;
but the compiler defaults 'char' to 'unsigned char'.

Note also that sdcc now comes with sdobjcopy (generates the same output here as arm-eabi-objcopy, so shouldn’t be a problem)
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Latest SDCC

Post by arnaud »

Hi,

I have been using SDCC 3.5:

Code: Select all

$ sdcc --version
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/TININative/ds400/hc08/s08/stm8 3.5.0 #9253 (Mar 24 2016) (Linux)
published under GNU General Public License (GPL)
I guess the char problem should be fixed by declaring the char as "signed char", sdcc changed its default there.

This is a good news for sobjcopy, though it does not come in the Ubuntu package apparently. What objcopy to use could be added as a Makefile configuration.

As a side note: I have been planing to work a on the Crazyradio code for the summer (mainly clean up and trying to implement a more efficient protocol to talk to swarms), could you share a bit more about what you are trying to do? There might be some synergy.
sjw
Beginner
Posts: 3
Joined: Sun Jul 09, 2017 5:51 pm

Re: Latest SDCC

Post by sjw »

"--fsigned-char" does the trick.

My problem is that my new Crazyflie 2 and CRPA won’t talk to each other (takes multiple tries to connect at all, then get poor quality connection which drops out pretty quickly), so I thought "let’s re-flash the CRPA" (no change), "let’s try the latest code" (no change).

Code: Select all

INFO:cflib.crazyflie:Callback->Connection initialized[radio://0/80/250K]
INFO:cflib.crazyflie:We are connected[radio://0/80/250K], request connection setup
INFO:cflib.crazyflie:Resending for pattern (93, 5)
WARNING:cflib.crazyflie:Got link error callback [Too many packets lost] in state [1]
INFO:cflib.crazyflie:Callback->Connected failed to [radio://0/80/250K]: Too many packets lost
I am a bit close to my WiFi, how can I avoid the channels it’s using? (channel 2; the Mac says ch 6 would be good; are these the same channels as Crazyflie uses?) - no, not interference from WiFi, just turned it off, no change).
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Latest SDCC

Post by arnaud »

The channels for Wifi and CRPA are not the same: the CRPA channel are spaced by 1MHz starting at 2400MHz. So channel 42 is at 2442MHz for example.

Have you tried to communicated at 2Mbps by re configuring the Crazyflie communication? You can do so with the client by connecting either with the radio or with USB. At 2M the radio is less sensitive to noise from other transmiter and packet collision are also reduced a lot so we have seen better results with it.
sjw
Beginner
Posts: 3
Joined: Sun Jul 09, 2017 5:51 pm

Re: Latest SDCC

Post by sjw »

Thanks for the response! I saw this in other topics, and I’m sure I tried it several times (the bootloader works fine, and I see that that uses 2M), but until this morning it wouldn’t "stick". Two possibilities:
  • I edited config.json directly (not while cfclient was running, of course): I think I set radio://0/0/2M first, and it’s now settled at 0/80/2M.
  • I also took the antenna off the CRPA, partly because I thought it might be broken and partly in case the signal was too strong. Of course the range was short; replaced the antenna.
Don’t know which of these did the trick!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Latest SDCC

Post by arnaud »

What json did you edit?

Anyway, nice that it is solved!
Post Reply