Page 1 of 1

Latest SDCC

Posted: Mon Jul 10, 2017 9:45 am
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)

Re: Latest SDCC

Posted: Mon Jul 10, 2017 10:05 am
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.

Re: Latest SDCC

Posted: Mon Jul 10, 2017 11:46 am
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).

Re: Latest SDCC

Posted: Tue Jul 11, 2017 8:47 am
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.

Re: Latest SDCC

Posted: Tue Jul 11, 2017 11:34 am
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!

Re: Latest SDCC

Posted: Thu Jul 13, 2017 9:06 am
by arnaud
What json did you edit?

Anyway, nice that it is solved!