Coder Social home page Coder Social logo

c4ev3 / ev3duder Goto Github PK

View Code? Open in Web Editor NEW
32.0 12.0 12.0 2.2 MB

The LEGO® EV3 Downloader/UploaDER.

Home Page: http://c4ev3.github.io/ev3duder/doc/html/globals_func.html

License: GNU General Public License v3.0

Makefile 1.10% Perl 1.28% C 82.01% Shell 0.62% Python 0.84% C++ 14.15%
lego ev3 ev3-robot embedded-systems

ev3duder's Introduction

ev3duder Build Status https://ci.appveyor.com/api/projects/status/github/c4ev3/ev3duder?svg=true Gitter Chat

The LEGO® EV3 Downloader/Uploader utility.

ev3duder is an implementation of the LEGO EV3's protocol over USB (HID), Bluetooth (RFCOMM) and WiFi (TCP). Run ev3duder --help for help.

Check the "Releases" tab for precompiled binaries. Building ev3duder on your own is quite easy too, though. It runs on Linux, Windows and OS X.

Compiling ev3duder

ev3duder requires a gnu99 compatible compiler, that is GCC 3.2 and above or compatible compilers. Any recent version of gcc, clang or icc should be able to compile it. MS Visual C++ isn't supported, due to the use of C99 features and GNU extensions. Also required is GNU Make.

Getting the source

Get the source with git:

$ git clone --recursive https://github.com/c4ev3/ev3duder

If you haven't got git, you will have to download these seperately: https://github.com/c4ev3/ev3duder/archive/master.zip and https://github.com/signal11/hidapi/archive/master.zip then unpack the hidapi archive into the hidapi directory of the ev3duder extraction path.

Building from source

$ make

Linux

On Linux, you additionally need libudev-dev to be installed. On Ubuntu and other Debian-based system this can be done via

$ sudo apt-get install libudev-dev

If you used only a simple git clone earlier, you may also need to download some missing git modules:

$ git submodule update --init --recursive

Also to allow access to the ev3 over USB without requiring root, appropriate udev rules must be created. This can be easily done with

$ make install

Tests

The test/ directionry contains some sample projects that do stuff on the EV3. perl flash.pl Test_Motors uploads and executes the Test_Motors project.

Compiling programs for the EV3

Generally, 2 files are needed:

  1. An ELF executable built for Linux on ARM. libc need not be dynamically linked (The standard firmware uses glibc).

stdlibc++ is not provided by default and would need to be uploaded separately and dynamically loaded or linked statically (e.g. by specifying -static-libstdc++ during linking with GCC 4.5+).

  1. A launcher file, so the program can be started from the built-in menu. This is not strictly required, as ev3duder can execute programs too, but a menu entry is more convenient.

Compiling for EV3 using gcc

Getting the toolchain

In order to compile C/C++ application you will need the arm-none-linux-gnueabi GCC or arm-linux-gnueabi GCC (Both are the same thing). The symlink_cross.sh script can be used to symlink the latter to the former.

Windows

Easiest way is via the CodeSourcery Lite package which can be gotten here: https://sourcery.mentor.com/GNUToolchain/package4574/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi.exe

Linux

The easiest way on Linux systems is to also use the CodeSourcery toolchain, since it automatically provides the build environment:

$ wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package4571/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
$ mkdir ~/CodeSourcery
$ tar -jxvf ~/arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -C ~/CodeSourcery/
$ echo export PATH=~/CodeSourcery/arm-2009q1/bin/:$PATH >> ~/.bashrc && . ~/.bashrc

You can also use the toolchain that is found in the repositories, but keep in mind that you might have to do some additional configuration with this toolchain. On Debian/Ubuntu the arm-linux toolchains can be installed using:

$ sudo apt install gcc-arm-linux-gnueabi

For C++:

$ sudo apt install g++-arm-linux-gnueabi

OS X

Carlson-Minot Inc. provides binary builds of CodeSourcery's GNU/ARM toolchain for OS X. It can be gotten here: http://www.carlson-minot.com/available-arm-gnu-linux-g-lite-builds-for-mac-os-x

Uploading

Optimzing for size (-Os) is preferred. As ev3duder doesn't handle remote debugging yet and AFAIK nothing else does, debug symbols should be skipped too (no need for -g).

Example commands to compile, upload and execute:

$ arm-linux-gnueabi-gcc main.c file.c -Os -o test
$ ev3duder up test.elf ../prjs/BrkPrg_SAVE/test
$ ev3duder mkrbf /home/a3f/lms2012/BrkPrg_SAVE/test test.rbf
$ ev3duder up test.rbf ../prjs/BrkPrg_SAVE/test.rbf
$ ev3duder run test.rbf

Alternatively, steps 4 and 5 can be omitted and the last step changed to ev3duder exec test.rbf; The downside of this is that no menu entry is generated. Another option is also installing the application, which will make it available with an optional icon in the apps menu:

$ ev3duder up test.rbf ../apps/test.rbf

For uploading to a SD Card, the paths /media/card or ../prjs/SD_Card/ can be used instead. A connected USB stick would be available under /media/usb/. Keep in mind that the Lego Menu doesn't show .rbf files at the root of the SD card, so it needs to be uploaded into a directory. ev3duder up does create the paths by default.

Documentation

As the commands ev3duder supports, mirror the functions internally used to implement them, the doxygen documentation of ["funcs.h"] should do as user manual. It's linked at the top or can be locally generated by running doxygen and openning the index.html file in a webbrowser.

Language

The utlity is written in GNU C99. The Makefile is GNU Make specific. The perl and shell scripts are complementary and not necessary.

ev3duder's People

Contributors

a3f avatar abke avatar d3st3r avatar dlech avatar dnlmlr avatar jakubvanek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ev3duder's Issues

.RBF compiling incorrectly?

Hello there!
I've just been trying to get the hello world app to compile and run on my EV3, but I've run into an issue.

I can compile an .ELF file from Eclipse by building the project (but I have never been able to upload code from eclipse).
After constant trouble with wifi and bluetooth, I've just commit to USB transfer.

Using ev3duder, I've tried compiling the .ELF to an .RBF from Windows and Linux, but neither seem to do it correctly. The program appears in the EV3 menu, but doesn't do anything.
The file sizes vary from systems, but are always much smaller than expected (~30-85 bytes!).
The upload always works though - at least, I see that the file sizes match between the EV3 and my computer :P

It's entirely possible that I'm doing something critically wrong here (for instance, stealing the .ELF from Eclipse), but I'd think it would still work? Should I generate the .ELF differently? Please let me know ;)

ev3duder not correctly working for Bluetooth on Windows

I cross-compiled ev3duder on Ubuntu 18 LTS and directly on Windows 7 - both with mingw64 32 bit.

Both compiled binaries don't work correctly for Bluetooth on Windows 7.

I am able to issue the info command successfully 2 times in a row which make the EV3 beep 2 times. After that, apparently the command cannot be sent anymore. The ls, dl and run commands don't work at all. I didn't verify the other commands.

The version compiled on/for Ubuntu 18 LTS works correctly for Bluetooth, except that the run command only succeeds once (the rbf is run on the EV3) and afterwards no commands succeed anymore.

Uploading on EV3 over TCP doesn't work.

Windows 10, I try FW 1.09H and 1.10E, Wi-Fi works fine with EV3-G, EV3-Basic.
ev3duder --tcp - all commands work except 'up'.
Use:
ev3duder --tcp=192.168.93.214 up test.rbf ../prjs/test/test.rbf
upload was successful.
File is created but zero size and after that no command is executed until reconnecting the wi-fi on the brick.
By USB - no problem.

Ubuntu package

FYI, I've packaged this in the ev3dev-tools PPA for Ubuntu.

sudo add-apt-repository ppa:ev3dev/tools
sudo apt update
sudo apt install ev3duder

You can also grab the .deb files from here if you don't want to use the PPA.

How to upload an uf2 file

Hi,

With the new uf2 pack(#15) command it is my understanding that you can upload and run an UF2 file from makecode.org directly on an EV3, but I have somehow failed to understand the steps. I try:

  1. Create a file and download it (named lego-untitled.uf2)
  2. ev3duder uf2 pack /home/user/lego-untitled.uf2 Projects test
  3. ...

That is, step 3 does not return anything meaningful - nor do I find the file on my EV3. Any tips on what I'm doing wrong? What is the correct usage of the third argument (test) - what does it do?

Regards,
Tarjei

debug make target compiles `hid.c` without debug flags

https://github.com/c4ev3/ev3duder/blob/5ceca3/Makefile#L107-L109

passing CLFAGS works, but produces several warnings, such as

hidapi/mac/hid.c:48:90: warning: unused parameter 'attr' [-Wunused-parameter]
static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
                                                                                         ^
hidapi/mac/hid.c:255:20: warning: comparison of integers of different signs: 'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                if (chars_copied == len)
                    ~~~~~~~~~~~~ ^  ~~~
hidapi/mac/hid.c:295:20: warning: comparison of integers of different signs: 'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                if (used_buf_len == len)
                    ~~~~~~~~~~~~ ^  ~~~
hidapi/mac/hid.c:551:65: warning: unused parameter 'result' [-Wunused-parameter]
static void hid_device_removal_callback(void *context, IOReturn result,

Upload sd-card data from ev3 to pc

Hello everyone,

is there any way to upload data from the SD-card without taking it out of the ev3?
I wrote a program that creates a text file and saves it on the SD-card. Now I want to analyze the data but I dont want to take it out each time I've changed something.

Enable full ls capability

Hi,

it seems that LEGO did implement the CONTINUE_LIST_FILES command after all (at least on the 1.09E/1.10E firmware). Enabling this in ev3duder allows one to get full directory listings.

ev3duder output:

$ ev3 ls /usr/bin
USB connection established.
00 0f 00 00 00 01 99 00 04 2f 75 73 72 2f 62 69 6e 00 
Checking reply: 
yes/
xargs/
4CBD338651C74C46C03A9BB83B75CF76 00000085 wpatest.sh
whoami/
who/
which/
wget/
wc/
wall/
vlock/
uptime/
unzip/
uniq/
udpsvd/
tty/
traceroute/
tr/
top/
time/
tftpd/
tftp/
test/
telnet/
tee/
tcpsvd/
478E5A4075C21AD3DEEC9FFA1AEC04E8 0000072C taskInfo
tail/
15A745826BEC8243735943B8207F315D 00002310 tabs
CD63D251F7D3093B17AC96FC5DB839AE 00000812 sysSettings
strings/
ssh/
splash-write/
sort/
3A639E242DE8DEEBC45562169D8F0ACB 000003B0 showoff_matrix
showkey/
CE97B27ECD3A70C39BF7B1DBEC149CF3 00004A60 setterm
setsid/
seq/
40671C099FEED342924774D3B2C7C4D7 0000FC4C sdptool
F7D23CE96C4DD6896434DB5BA90A9891 00002D64 script.util-linux-ng
scp/
E1733A246612F47657DD88D2B3A88BD3 00000707 runWhetstone
2D8FFC460CE3FC890600AD35E4E9DF8C 00000049 runSystemShutdown
23D5F16B001B1AAB94941AB83142028E 000006FC runLinpack
8BC7FA3C60DADDCD6515B11C459A46A7 00000825 runDhrystone
rtcwake/
F09ED5640CD4F6E884C75E1B8997B864 000079E0 rfcomm
reset.ncurses/
reset/
renice/
realpath/
readlink/
readahead/
CE429C9D5B79277BCE2CB27B 0yes/
xargs/
4CBD338651C74C46C03A9BB83B75CF76 00000085 wpatest.sh
whoami/
who/
which/
wget/
wc/
wall/
vlock/
uptime/
unzip/
uniq/
udpsvd/
tty/
traceroute/
tr/
top/
time/
tftpd/
tftp/
test/
telnet/
tee/
tcpsvd/
478E5A4075C21AD3DEEC9FFA1AEC04E8 0000072C taskInfo
tail/
15A745826BEC8243735943B8207F315D 00002310 tabs
CD63D251F7D3093B17AC96FC5DB839AE 00000812 sysSettings
strings/
ssh/
splash-write/
sort/
3A639E242DE8DEEBC45562169D8F0ACB 000003B0 showoff_matrix
showkey/
CE97B27ECD3A70C39BF7B1DBEC149CF3 00004A60 setterm
setsid/
seq/
40671C099FEED342924774D3B2C7C4D7 0000FC4C sdptool
F7D23CE96C4DD6896434DB5BA90A9891 00002D64 script.util-linux-ng
scp/
E1733A246612F47657DD88D2B3A88BD3 00000707 runWhetstone
2D8FFC460CE3FC890600AD35E4E9DF8C 00000049 runSystemShutdown
23D5F16B001B1AAB94941AB83142028E 000006FC runLinpack
8BC7FA3C60DADDCD6515B11C459A46A7 00000825 runDhrystone
rtcwake/
F09ED5640CD4F6E884C75E1B8997B864 000079E0 rfcomm
reset.ncurses/
reset/
renice/
realpath/
readlink/
readahead/
CE429C9D5B79277BCE2CB20004460 rctest
A6225BBCE3B6A5B4D3708C5C251D471B 00000DC0 psplash-write
psplash/
printf/
patch/
passwd/
BAAA1E4366918A6D3656955AA395732C 00007428 pand
FE798481309D29A485D4A13BFD46C8A7 00001FE8 oppserver
opkg/
openvt/
8F316910781211ACE989F7C69B42BD87 00000104 openssl_start_server.sh
68219D0C44B7730B15BBF3773122954C 000002D3 openssl_perf.sh
222225FC7DF129B7B8228302D23D42DE 0000016C openssl_gen_sha1hash.sh
0E6C88CC8C560B1FDD548FB1139F46C1 00000170 openssl_gen_pubkey.sh
5BD27AC7B69F4784C447EAC1047CEB28 000002EB openssl_gen_cert.sh
D4A55BCE195AC50402D2FBE649498569 000000DA openssl_display_cert.sh
E248D7F70C6A1E0011993C6119E16786 0000054D openssl_aes256_encdec.sh
E24A70EC3EA8B00CFCBA56E9D5C0334B 0009C228 openssl
od/
nslookup/
nohup/
newgrp/
33B1CFFC627F9983AB256E0BE77CAFA5 00000749 networkSettings
nc/
mkfifo/
microcom/
mesg/
3FABD26740775679172A8B7B9E19E250 000011F0 mem_util
0A74BABA1677F538538017C8577B2B3E 0000074E memInfo
md5sum/
1F89CCEC76727AEB62E7033E3EB0EE47 00000501 lsb_release
logname/
logger/
linux64/
linux32/
less/
lastb/
last/
CD4F7700AE7CB51569F9C7C0AB9E4B8C 00007808 l2test
killall/
iptables-xmd/
BAAA1E4366918A6D3656955AA395732C 00007428 pand
FE798481309D29A485D4A13BFD46C8A7 00001FE8 oppserver
opkg/
openvt/
8F316910781211ACE989F7C69B42BD87 00000104 openssl_start_server.sh
68219D0C44B7730B15BBF3773122954C 000002D3 openssl_perf.sh
222225FC7DF129B7B8228302D23D42DE 0000016C openssl_gen_sha1hash.sh
0E6C88CC8C560B1FDD548FB1139F46C1 00000170 openssl_gen_pubkey.sh
5BD27AC7B69F4784C447EAC1047CEB28 000002EB openssl_gen_cert.sh
D4A55BCE195AC50402D2FBE649498569 000000DA openssl_display_cert.sh
E248D7F70C6A1E0011993C6119E16786 0000054D openssl_aes256_encdec.sh
E24A70EC3EA8B00CFCBA56E9D5C0334B 0009C228 openssl
od/
nslookup/
nohup/
newgrp/
33B1CFFC627F9983AB256E0BE77CAFA5 00000749 networkSettings
nc/
mkfifo/
microcom/
mesg/
3FABD26740775679172A8B7B9E19E250 000011F0 mem_util
0A74BABA1677F538538017C8577B2B3E 0000074E memInfo
md5sum/
1F89CCEC76727AEB62E7033E3EB0EE47 00000501 lsb_release
logname/
logger/
linux64/
linux32/
less/
lastb/
last/
CD4F7700AE7CB51569F9C7C0AB9E4B8C 00007808 l2test
killall/
iptables-xmocap/
id/
CC99EB8A42AFCFAE4B7062FFDECC7345 00008E44 hidd
hexdump/
head/
F74D102C99B8A3D8D3CE08BFCE82C4B5 0000B30C hcitool
963FF87AB8B3911A2637D1E9F6620743 0000CC8F gdbserver
fuser/
free/
FAEC243BD2E50D080626515799CACD2E 00001FA4 flock.util-linux-ng
find/
expr/
env/
dumpleases/
du/
dirname/
diff/
deallocvt/
dc/
774C1B8696791500A2F07108942CCC40 000013CC dbus-uuidgen
55A6C86AF42AF1BCF5E5C5E882D49605 00003A04 dbus-send
96E34A23EACDC0A89A51C1DCA6DE802F 00002D24 dbus-monitor
2AC58DC0C8D9E0485225357BEC119461 00003770 dbus-launch
BF8E867A95441BB18E050F48737405CA 0003B818 dbus-daemon
6E08FF576C84E2F92280D8C010ECF288 00001BB8 dbus-cleanup-sockets
dbclient/
cut/
cryptpw/
cmp/
8796B5CD3622AA671087975DA37D1678 00000EC8 clear.ncurses
clear/
A459562F20C385A8A939BBEE17F4D5B6 00002B40 ciptool
chvt/
chsh/
683F6A43D3525ECC08483FED31B3DF82 00001CA4 chrt.util-linux-ng
chrt/
F7F6D7CE861776DA076805753FCF3F6A 00000E94 chkdupexe
chfn/
75A7C3268A69DFC17228C79B2A1008D1 00001C6C chattr.e2fsprogs
captoinfo/
07CDF8033C6C8580174F02ocap/
id/
CC99EB8A42AFCFAE4B7062FFDECC7345 00008E44 hidd
hexdump/
head/
F74D102C99B8A3D8D3CE08BFCE82C4B5 0000B30C hcitool
963FF87AB8B3911A2637D1E9F6620743 0000CC8F gdbserver
fuser/
free/
FAEC243BD2E50D080626515799CACD2E 00001FA4 flock.util-linux-ng
find/
expr/
env/
dumpleases/
du/
dirname/
diff/
deallocvt/
dc/
774C1B8696791500A2F07108942CCC40 000013CC dbus-uuidgen
55A6C86AF42AF1BCF5E5C5E882D49605 00003A04 dbus-send
96E34A23EACDC0A89A51C1DCA6DE802F 00002D24 dbus-monitor
2AC58DC0C8D9E0485225357BEC119461 00003770 dbus-launch
BF8E867A95441BB18E050F48737405CA 0003B818 dbus-daemon
6E08FF576C84E2F92280D8C010ECF288 00001BB8 dbus-cleanup-sockets
dbclient/
cut/
cryptpw/
cmp/
8796B5CD3622AA671087975DA37D1678 00000EC8 clear.ncurses
clear/
A459562F20C385A8A939BBEE17F4D5B6 00002B40 ciptool
chvt/
chsh/
683F6A43D3525ECC08483FED31B3DF82 00001CA4 chrt.util-linux-ng
chrt/
F7F6D7CE861776DA076805753FCF3F6A 00000E94 chkdupexe
chfn/
75A7C3268A69DFC17228C79B2A1008D1 00001C6C chattr.e2fsprogs
captoinfo/
07CDF8033C6C8580174F02DA 00003218 cal.util-linux-ng
bzcat/
bunzip2/
9B11C313BDEA44D157BB9E201CD576FB 00000034 browser
basename/
awk/
arecord/
2F8568AC951D5EC1B4BCFEF94383A0C4 00000C04 arch
ar/
A15C0FC4176397936649C000F75947D3 00002E78 agent
[[/
[/
`LIST_FILES` was successful.

ls output:

root@EV3:/usr/bin# ls -l
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 [ -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 [[ -> ../../bin/busybox
-rwxr-xr-x    1 root     root        11896 Jan  1 00:00 agent
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 ar -> ../../bin/busybox
-rwxr-xr-x    1 root     root         3076 Jan  1 00:00 arch
lrwxrwxrwx    1 root     root            5 Jan  1 00:00 arecord -> aplay
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 awk -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 basename -> ../../bin/busybox
-rwxr-xr-x    1 root     root           52 Jan  1 00:00 browser
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 bunzip2 -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 bzcat -> ../../bin/busybox
-rwxr-xr-x    1 root     root        12824 Jan  1 00:00 cal.util-linux-ng
lrwxrwxrwx    1 root     root            3 Jan  1 00:00 captoinfo -> tic
-rwxr-xr-x    1 root     root         7276 Jan  1 00:00 chattr.e2fsprogs
lrwxrwxrwx    1 root     root           18 Jan  1 00:00 chfn -> chfn.util-linux-ng
-rwxr-xr-x    1 root     root         3732 Jan  1 00:00 chkdupexe
lrwxrwxrwx    1 root     root           18 Jan  1 00:00 chrt -> chrt.util-linux-ng
-rwxr-xr-x    1 root     root         7332 Jan  1 00:00 chrt.util-linux-ng
lrwxrwxrwx    1 root     root           18 Jan  1 00:00 chsh -> chsh.util-linux-ng
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 chvt -> ../../bin/busybox
-rwxr-xr-x    1 root     root        11072 Jan  1 00:00 ciptool
lrwxrwxrwx    1 root     root           13 Jan  1 00:00 clear -> clear.ncurses
-rwxr-xr-x    1 root     root         3784 Jan  1 00:00 clear.ncurses
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 cmp -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 cryptpw -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 cut -> ../../bin/busybox
lrwxrwxrwx    1 root     root           23 Jan  1 00:00 dbclient -> /usr/sbin/dropbearmulti
-rwxr-xr-x    1 root     root         7096 Jan  1 00:00 dbus-cleanup-sockets
-rwxr-xr-x    1 root     root       243736 Jan  1 00:00 dbus-daemon
-rwxr-xr-x    1 root     root        14192 Jan  1 00:00 dbus-launch
-rwxr-xr-x    1 root     root        11556 Jan  1 00:00 dbus-monitor
-rwxr-xr-x    1 root     root        14852 Jan  1 00:00 dbus-send
-rwxr-xr-x    1 root     root         5068 Jan  1 00:00 dbus-uuidgen
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 dc -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 deallocvt -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 diff -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 dirname -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 du -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 dumpleases -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 env -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 expr -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 find -> ../../bin/busybox
-rwxr-xr-x    1 root     root         8100 Jan  1 00:00 flock.util-linux-ng
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 free -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 fuser -> ../../bin/busybox
-rwxr-xr-x    1 root     root        52367 Jan  1 00:00 gdbserver
-rwxr-xr-x    1 root     root        45836 Jan  1 00:00 hcitool
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 head -> ../../bin/busybox
lrwxrwxrwx    1 root     root           21 Jan  1 00:00 hexdump -> hexdump.util-linux-ng
-rwxr-xr-x    1 root     root        36420 Jan  1 00:00 hidd
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 id -> ../../bin/busybox
lrwxrwxrwx    1 root     root            3 Jan  1 00:00 infotocap -> tic
lrwxrwxrwx    1 root     root           24 Jan  1 00:00 iptables-xml -> /usr/sbin/iptables-multi
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 killall -> ../../bin/busybox
-rwxr-xr-x    1 root     root        30728 Jan  1 00:00 l2test
lrwxrwxrwx    1 root     root           13 Jan  1 00:00 last -> last.sysvinit
lrwxrwxrwx    1 root     root            4 Jan  1 00:00 lastb -> last
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 less -> ../../bin/busybox
lrwxrwxrwx    1 root     root            7 Jan  1 00:00 linux32 -> setarch
lrwxrwxrwx    1 root     root            7 Jan  1 00:00 linux64 -> setarch
lrwxrwxrwx    1 root     root           20 Jan  1 00:00 logger -> logger.util-linux-ng
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 logname -> ../../bin/busybox
-rwxr-xr-x    1 root     root         1281 Jan  1 00:00 lsb_release
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 md5sum -> ../../bin/busybox
-rwxr-xr-x    1 root     root         1870 Jan  1 00:00 memInfo
-rwxr-xr-x    1 root     root         4592 Jan  1 00:00 mem_util
lrwxrwxrwx    1 root     root           13 Jan  1 00:00 mesg -> mesg.sysvinit
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 microcom -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 mkfifo -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 nc -> ../../bin/busybox
-rwxr-xr-x    1 root     root         1865 Jan  1 00:00 networkSettings
lrwxrwxrwx    1 root     root           20 Jan  1 00:00 newgrp -> newgrp.util-linux-ng
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 nohup -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 nslookup -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 od -> ../../bin/busybox
-rwxr-xr-x    1 root     root       639528 Jan  1 00:00 openssl
-rwxr-xr-x    1 root     root         1357 Jan  1 00:00 openssl_aes256_encdec.sh
-rwxr-xr-x    1 root     root          218 Jan  1 00:00 openssl_display_cert.sh
-rwxr-xr-x    1 root     root          747 Jan  1 00:00 openssl_gen_cert.sh
-rwxr-xr-x    1 root     root          368 Jan  1 00:00 openssl_gen_pubkey.sh
-rwxr-xr-x    1 root     root          364 Jan  1 00:00 openssl_gen_sha1hash.sh
-rwxr-xr-x    1 root     root          723 Jan  1 00:00 openssl_perf.sh
-rwxr-xr-x    1 root     root          260 Jan  1 00:00 openssl_start_server.sh
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 openvt -> ../../bin/busybox
lrwxrwxrwx    1 root     root           16 Jan  1 00:00 opkg -> /usr/bin/opkg-cl
-rwxr-xr-x    1 root     root         8168 Jan  1 00:00 oppserver
-rwxr-xr-x    1 root     root        29736 Jan  1 00:00 pand
lrwxrwxrwx    1 root     root           19 Jan  1 00:00 passwd -> ../../bin/tinylogin
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 patch -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 printf -> ../../bin/busybox
lrwxrwxrwx    1 root     root           27 Jan  1 00:00 psplash -> /usr/bin/psplash.psplash-ti
-rwxr-xr-x    1 root     root         3520 Jan  1 00:00 psplash-write
-rwxr-xr-x    1 root     root        17504 Jan  1 00:00 rctest
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 readahead -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 readlink -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 realpath -> ../../bin/busybox
lrwxrwxrwx    1 root     root           20 Jan  1 00:00 renice -> renice.util-linux-ng
lrwxrwxrwx    1 root     root           13 Jan  1 00:00 reset -> reset.ncurses
lrwxrwxrwx    1 root     root            4 Jan  1 00:00 reset.ncurses -> tset
-rwxr-xr-x    1 root     root        31200 Jan  1 00:00 rfcomm
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 rtcwake -> ../../bin/busybox
-rwxr-xr-x    1 root     root         2085 Jan  1 00:00 runDhrystone
-rwxr-xr-x    1 root     root         1788 Jan  1 00:00 runLinpack
-rwxr-xr-x    1 root     root           73 Jan  1 00:00 runSystemShutdown
-rwxr-xr-x    1 root     root         1799 Jan  1 00:00 runWhetstone
lrwxrwxrwx    1 root     root           23 Jan  1 00:00 scp -> /usr/sbin/dropbearmulti
-rwxr-xr-x    1 root     root        11620 Jan  1 00:00 script.util-linux-ng
-rwxr-xr-x    1 root     root        64588 Jan  1 00:00 sdptool
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 seq -> ../../bin/busybox
lrwxrwxrwx    1 root     root           20 Jan  1 00:00 setsid -> setsid.util-linux-ng
-rwxr-xr-x    1 root     root        19040 Jan  1 00:00 setterm
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 showkey -> ../../bin/busybox
-rwxr-xr-x    1 root     root          944 Jan  1 00:00 showoff_matrix
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 sort -> ../../bin/busybox
lrwxrwxrwx    1 root     root           13 Jan  1 00:00 splash-write -> psplash-write
lrwxrwxrwx    1 root     root           23 Jan  1 00:00 ssh -> /usr/sbin/dropbearmulti
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 strings -> ../../bin/busybox
-rwxr-xr-x    1 root     root         2066 Jan  1 00:00 sysSettings
-rwxr-xr-x    1 root     root         8976 Jan  1 00:00 tabs
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 tail -> ../../bin/busybox
-rwxr-xr-x    1 root     root         1836 Jan  1 00:00 taskInfo
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 tcpsvd -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 tee -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 telnet -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 test -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 tftp -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 tftpd -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 time -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 top -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 tr -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 traceroute -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 tty -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 udpsvd -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 uniq -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 unzip -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 uptime -> ../../bin/busybox
lrwxrwxrwx    1 root     root           19 Jan  1 00:00 vlock -> ../../bin/tinylogin
lrwxrwxrwx    1 root     root           13 Jan  1 00:00 wall -> wall.sysvinit
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 wc -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 wget -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 which -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 who -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 whoami -> ../../bin/busybox
-rwxr-xr-x    1 root     root          133 Jan  1 00:00 wpatest.sh
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 xargs -> ../../bin/busybox
lrwxrwxrwx    1 root     root           17 Jan  1 00:00 yes -> ../../bin/busybox

Best regards,

Jakub

[Feature Request] Updating brick firmware

Hi,

I think it is sometimes useful to have the ability to upload a new firmware to the brick. So far on Linux this has been provided by the C# firmware loader. I have written a different tool for my need, but I think it would be nice to have this in ev3duder too.

I believe the builtin EV3 EEPROM is responsible for handling the upload. The write protect pin is permanently activated, so I think it is not possible to hard-brick the brick this way. see last comment

I don't know from where the protocol originates. I think it comes from BricxCC and it is not publicly documented. However it is very similar to the protocol that the LMS2012 VM uses when it is running. It is using system commands too, but it is using different command IDs.

The upload has four phases:

  • The bootloader is asked to erase the flash chip (this is optionally handled together with the following step).
  • The firmware binary is uploaded to the bootloader similarly to how normal files are uploaded (begin & continue requests).
  • The bootloader is asked to produce a checksum of the newly uploaded data.
  • The bootloader is then asked to do a reboot to the new system.

There are two more commands:

  • It is possible to ask the bootloader about its version and the hardware version (both are V0.60 on my brick).
  • It is possible to ask the running Linux system to reboot into the bootloader quickly without saving any data.

It may be even possible do partial uploads that would preserve user data by not erasing the whole chip. However I have not yet tested this. The remaining functionality is tested to work.

I have the following proposal for the interface:

# Exit Linux and enter firmware upload mode
ev3 flash enter

# Upload the firmware
# - either performing all the steps or only the upload phase (advanced)
# - optionally upload from address n to address n+len(@file.img)
# - optionally select flash erase mode
ev3 flash upload <file.img> [--only] [--start n] [--erase-mode=separate/merged]

# Erase the entire flash contents (= separate flash erasure)
ev3 flash erase

# Ask the bootloader for flash CRC32
ev3 flash crc32 <start> <end>

# Show information about the bootloader
ev3 flash info

# Exit the bootloader
ev3 flash exit

Best regards,

Jakub

Serial Port doesn't work with serial ports greater COM9 on Windows

From Microsoft support:
CreateFile() is successful when you use "COM1" through "COM9" for the name of the file; however, the message "INVALID_HANDLE_VALUE" is returned if you use "COM10" or greater.

If the name of the port is \.\COM10, the correct way to specify the serial port in a call to CreateFile() is as follows:
CreateFile("\\.\COM10"...) .
URL: https://support.microsoft.com/en-us/topic/howto-specify-serial-ports-larger-than-com9-db9078a5-b7b6-bf00-240f-f749ebfd913e

"clean" of Makefile fails on Windows because pre-defined Unix RM of make not overwritten

Problematic line:

RM ?= del /Q

Proposed fix:
RM = del /Q

Detailed output when failing:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

Z:\>mingw32-make clean
rm -f ev3duder.exe
process_begin: CreateProcess(NULL, rm -f ev3duder.exe, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [clean] Error 2

Z:\>mingw32-make --version
GNU Make 4.0
Built for i686-w64-mingw32
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Spurious incomplete upload

Reported here: c4ev3/EV3-API#10 (comment)

OK I have to say I don't understand at all what is happening.
Your test went succesfully (I add bs=1 in the dd command line).
Back to my real program and my script to download it into the brick:
Most of the it works work with thel ELF, and sometimes not, and I can't fund a rule...
Altough, the rbf file is usually not properly downloaded:
On my computer : #ll

[fabien@HPDEB ~/devel/eworkspace/test ]$ ll
total 748
-rwxrwxr-x+ 1 fabien domain users 0 Oct 13 22:23 make.c
-rwxrwxr-x+ 1 fabien domain users 311 Oct 15 10:29 make_test_sdcard.sh
-rwxrwxr-x+ 1 fabien domain users 320 Oct 14 19:02 make_test.sh
-rwxrwxr-x+ 1 fabien domain users 650691 Oct 15 10:30 test
-rwxrwxr-x+ 1 fabien domain users 65872 Oct 7 22:08 test.bin.bak
-rwxrwxr-x+ 1 fabien domain users 454 Oct 14 20:05 test.c
-rwxrwxr-x+ 1 fabien domain users 72 Oct 15 10:30 test.rbf

 $ ev3duder up test.rbf ../prjs/SD_Card/BrkPrg_SAVE/test.rbf
    USB connection established.
    `upload` was successful.
 $ ev3duder ls ../prjs/SD_Card/BrkPrg_SAVE
    USB connection established.
    00 22 00 00 00 01 99 00 04 2e 2e 2f 70 72 6a 73 2f 53 44 5f 43 61 72 64 2f 42 72 6b 50 72 67 5f 53 41 56 45 00 
    Checking reply: 
    D41D8CD98F00B204E9800998ECF8427E 00000000 test.rbf
    0A228D449871F44FDD1AC889F4FA794E 0009EDC3 test

The size of the rbf file is zero!

I add the 'sync' command in my script file between each ev3duder download command, but it change nothing.

Bluetooth not working on Linux

Hi,

it seems that if /dev/rfcomm0 is used on Linux as a serial port, it behaves like a TTY and it transmits escape sequences to the brick after the real message when a read is performed. In Wireshark, it manifests as single-byte messages being transmitted, together forming strange sequences like ^C, ^H, ^@ etc. However, I am not yet certain this is unexpected because parts of EV3 replies come back as single-byte messages too.

Best regards,

Jakub

Uploading on EV3 doesn't work

If I try to upload my programm on my USB-connected EV3, the upload gets stuck after around 20%.

Output in the Window "Uploading to EV3..." is:

Preprocessing start.lms [DONE]
Generating rbf: C:\Users\john\AppData\Local\Temp\ev3starter5161276984488606014

Then it gets stuck.

[Feature Request] Support for UF2 files

Hi!

I think that it might be useful for ev3duder to have the ability to handle UF2 files. The format is seems like just a block-based file container. It is documented here and here is a reference implementation that looks like some older version of it is running on the actual brick.

In particular, I have the following functionality in mind:

  • Packing UF2 files. This would allow one to upload C4EV3 programs by dropping them to the emulated file system.
    • The UF2 files produced by MakeCode have files internally named like Projects/AAA.elf and Projects/AAA.rbf. The brick then extracts them to /home/root/lms2012/prjs/BrkProg_SAVE. I don't know yet if it is possible to upload files to a different location.
    • Depending on whether it is possible to use nonstandard destinations, it may be good to include some path-mapping functionality to increase flexibility. One of the solutions could be to behave like tar does - interpret the file paths relative to CWD and put them like that to the UF2.
  • Unpacking UF2 files. This would allow one to inspect the contents of the files. This would just unpack the file and directory structure contained in the UF2. I don't think path-mapping would be useful here.
  • Uploading UF2 files via the LEGO USB protocol. This would combine the unpacking functionality with the upload functionality currently present in ev3duder. This would be helpful on Linux, where there are problems with mounting the emulated file system. The path mapping in this case may be easier: Projects/... would go to the BrkProg_SAVE directory and other paths would be interpreted directly.

Best regards,

Jakub

EV3 firmware flash stuck on bootloader_start call and returned VM_SYS_RQ reply

I tried to flash my EV3 using ev3duder from the HEAD of master branch and bricked my device. All attempts to reflash it were failed.

After spending some time debugging I figured out that VM returned 0x01 reply in bootloader_start function call which is defined as VM_SYS_RQ internally.

Only changing FW request from FW_START_DOWNLOAD to FW_START_DOWNLOAD_WITH_ERASE helped and solved the issue in blinstall.c file in bootloader_start function.
FW_START_DOWNLOAD *request = packet_alloc(FW_START_DOWNLOAD, 0);
FW_START_DOWNLOAD_WITH_ERASE *request = packet_alloc(FW_START_DOWNLOAD_WITH_ERASE, 0);

System info:
Linux kernel 5.8.0-38-generic
Ubuntu 20.10
SMP x86_64 x86_64 x86_64 GNU/Linux

Eclipse Neon 2.0 cpp EV3duder couldn't be found in !

Hello I am pretty new to this topic and Eclipse and I hope you can help or know someone who can support me. I installed Eclipse Neon 2.0 cpp and wanted to test the EV3 "Hello World". But when I try to upload and run the programm I always get a message Uploader not found "Ev3duder couldn't be found in !
When I press OK, I get the message The project's uploader path <> is invalid. Try correcting it. But how?

When I start a new project I define the path with C:\ev3\uploader as it is installed automatically. But when I open project\properties\C/C++ Build\Setting\Toolchains --> The line EV3 Uploader (ev3duder) is empty. I tried to use the browse button and copied the path from the explorer but when I Apply and press OK the failure still remains. When I go back to the settings the EV3 Uploader is still empty.

I trying to program my EV3 with the c4EV3 since some weeks but still have problems. As I already wrote I am new to Eclipse and if you would have some more documentation or a workaround it would be a great help.

KR Paul

Bluetooth communication

Hi,
I'm using the eclipse plugin as described in: http://c4ev3.github.io/.
In my project I want to controll the EV3 via bluetooth (Android).
Here is a code snipped, what I'm currently trying to do on EV3 side.

Includes & definitions:

#include "stdio.h"
#include "string.h"
#include "ctype.h"
#include "unistd.h"
#include "stdlib.h"
#include "bluetooth/bluetooth.h"
#include "bluetooth/sdp.h"
#include "bluetooth/sdp_lib.h"

#define DEV_ADDR "E4:12:1D:96:10:EF"    // MAC address of service device
#define BYTE    uint8_t
#define UUID    uuid_t
#define LIST    sdp_list_t
#define SESSION sdp_session_t
#define RECORD  sdp_record_t
#define DATA    sdp_data_t

Code:

...
// Server UUID: "d8308c4e-9469-4051-8adc-7a2663e415e2"
    static BYTE uuid[16] = {    // UUID as byte array
      0xd8, 0x30, 0x8c, 0x4e, 0x94, 0x69, 0x40, 0x51,
      0x8a, 0xdc, 0x7a, 0x26, 0x63, 0xe4, 0x15, 0xe2
    };
    int chan;
    chan = GetServiceChannel( uuid );
    if( chan > 0 ) {
      printf( "specified service is on channel %d\n", chan );
    }
...
int GetServiceChannel( BYTE *uuid)   // uuid of service as 16 bytes
{
    SESSION *s;
    UUID svc_uuid;
    LIST *response_list,*search_list,*attrid_list,*r;
    RECORD *rec;
    int range;
    int n;
    BYTE addr[6];   // define my own addr type
    int chan=0;

    // CONNECT TO SDP SERVER
    // (Note: device must be ON but server need not be running)
    str2ba( DEV_ADDR, (bdaddr_t *)&addr );
    s = sdp_connect( BDADDR_ANY, (bdaddr_t *)&addr, SDP_RETRY_IF_BUSY );
    if( !s ) {
      fprintf( stderr, "can't connect to sdp server\n" );
      return( 0 );
    }
...

The function sdp_connect is not connecting to the rfcomm socket on my android device.
Is there a better way to access the bluetooth functionalities of the EV3 Brick? I didn't find any information in the official EV3 documentation. I was hoping you'd have some experience in using EV3 bluetooth. Thank you.

[Feature Request] Closing handles

Hi,

I've observed that sometimes upload bugs itself in a way that leaves the destination file open for writing. This makes it impossible for Linux to exec() it later - the request fails with ETXTBSY or something like that. One reproducible way of triggering this is to start ev3duder upload when a C4EV3 program is running (i.e. when the USB communications over /dev/lms_usbdev are not serviced). After the C4EV3 program exits, the lms2012 VM sees the start packet, opens the file and waits for more input to come. However, that data may never come, as the uploader often times out before the program end.

One solution would be to add either /dev/lms_usbdev draining or a full-fledged EV3 protocol stack to C4EV3. However, it would still be useful to have the ability to close the orphaned handle directly from ev3duder.

Therefore I'd propose the following interface.

ev3duder closehnd all   # close all 256 handles
ev3duder closehnd 1     # close handle 1

Best regards,

Jakub

[Feature Request] Direct bytecode execution

Hi,

this is hopefully my last feature request :D
I think it would be nice to have a way of sending direct commands to the brick. Currently only selected commands are supported. This would expand the scope to all commands available.

The direct command request encoding is quite simple:
https://github.com/JakubVanek/ev3tool/blob/37582e398df192ef4078946877e03e253f707d80/libcomm/src/ev3loader/commands/direct/execute.cpp#L18

Therefore I'd propose the following interface:

ev3 directcmd <number of locals> \
              <number of globals> \
              <source file with bytecode or - for stdin> \
              <destination file for globals or - for stdout> \
              [--noreply]

Best regards,

Jakub

Bluetooth does not seem to work with EV3

I run ev3duder on Windows 10 64Bit which is connected via Bluetooth to an EV3 HW: 0.60, FW: 1.09H .

The Bluetooth connection works fine with the Mindstorm software. If I run ev3duder however, it hangs at "Checking reply":

PS C:\Users\carsten> C:\ev3\uploader\ev3duder.exe --serial=COM7 ls
00 08 00 00 00 01 99 00 04 2f 00
Checking reply:

Bluetooth Problem

Hi there.

I'm using C4EV3 on Windows 10 and its working fine via USB. Thanks again for this nice piece of software.

I'm now facing troubles to upload the code via ev3duder.

  1. If the project is configured to use the SD Card, the resulting program is uploaded to the media card and can be re-used anytime. However, when the project is configured to use the EV3 Brick Internal Memmory, after the the firs run (clicking on Upload and Run), the desappear from the brick.

  2. I'm also trying to upload via bluetooh, from inside the Eclipse IDE. After pairing the device, a virtual comport is created. However, I wasn't able to configure it and upload the program.

Can I have some tips on these topics? Thanks again.

unpack/mkrbf produce incorrect rbf files for MakeCode uf2/elf files

I stumbled over that problem when trying to upload a uf2 file to the EV3 (via Bluetooth on Linux).

How to reproduce:

  1. Open https://makecode.mindstorms.com/#editor in a browser and create a really simple program like the following.
    simplistic_makecode_program
  2. Download the uf2 file of the just created program, e.g. lego-Untitled.uf2.
  3. Unpack the uf2 file with the following command.
    ev3duder uf2 unpack lego-Untitled.uf2
  4. Upload the unpacked files with the following commands to the EV3 (here via Bluetooth - rfcomm0).
ev3duder --serial=/dev/rfcomm0 up Untitled.elf ../prjs/BrkProg_SAVE/Untitled.elf
ev3duder --serial=/dev/rfcomm0 up Untitled.rbf ../prjs/BrkProg_SAVE/Untitled.rbf
  1. Execute the program on the EV3 via it's menu.
    After starting the program, the EV3 will show a blank screen until it's return button is pressed.

I compared the correct rbf file, which is created by the EV3 when putting the uf2 file on it via USB, with the rbf file created by unpack. To achieve that, I downloaded the working rbf file via ev3duder Bluetooth from the brick. The only difference is the file length - the file created by the brick is 256 bytes long - which is 144 null bytes longer than the one created by unpack. Appending null bytes to the file created by unpack can be achieved with the following command.
truncate -s +144 Untitled.rbf

mkrbf creates a non-working rbf file which differs in content as well as in size from the working one.
ev3duder mkrbf ../prjs/BrkProg_SAVE/Untitled.elf Untitled.rbf

For OpenRoberta uf2 files, both means produce a working rbf file - unpack as well as mkrbf.

Some more remarks:

  • The workaround regarding the EV3 file system problem doesn't work for me - see #31 (comment).
    Edit 2021-03-30: Regarding the file system issue see also microsoft/uf2-linux#6 and microsoft/pxt-ev3#980.
  • It would be nice to know if it is possible to upload uf2 files directly to a directory of the EV3 where it finds them and automatically produces the correct output. When connecting the EV3 via USB, there is a directory where the uf2 files still reside, but I didn't find it (yet) on the EV3 itself.
    Edit 2021-03-30: Apparently latter uf2 files are emulated according to this comment.
  • Edit 2021-03-30: The tool files2uf2 produces the correct files including directory structure from a MakeCode uf2:
    https://github.com/simonedegiacomi/files2uf2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.