I want to test DTLS libraries on two K64F board with ARM Mbed OS. I have just created a new project:
mbed new .
I have created a folder called source and copied there dtls_client.c obtained from the mbeddtls project page. I have changed the value of the SERVER_ADDR constant.
I have repeated this process with dtls_server.c file.
Both project compiled without errors.
mbed compile -m K64F -t GCC_ARM -c
I copied each bin file to a different board but when I connect to them through the putty terminal I cannot see anything. I have been using this connection with the rest of my programs and it works. I think It may have something related to connection (now it is 115200).
I see that the code uses a mbedtls_printf function to print messages. I have tried inserting some printf traces but I don't see them either. How should I set the terminal to be able to see something?
#jordi,
Baudrate of 115200 should be OK for K64F.
You should verify that you have DEBUG_LEVEL set to a value higher than 0, and that Mbed TLS is compiled in debug mode.
Please compile your application with the following command:
mbed compile -m K64F -t GCC_ARM -c --profile=mbed-os/tools/profiles/debug.json
In addition, you should verify that your configuration file has MBEDTLS_DEBUG_C configured
Related
I am trying to debug a cross-compiled application with gdbserver. Unfortunately I get the following error on my host:
Reply contains invalid hex digit 59
Here's what I did:
compiled my application "line-generator" (which is just a test program) with gcc -ggdb3 -std=gnu89 flags (using -g instead of -ggdb3 didn't make any difference)
copy the executable to my embedded system. The exec can be executed there
started gdbserver 192.168.10.20:54320 line-generator on the embedded system
On the host I start gdb: gdb line-generator.gdb
(gdb) target remote 192.168.10.102:54320
Got this response on host:
Remote debugging using 192.168.10.102:54320
Reply contains invalid hex digit 59
On the server I got this:
Remote debugging from host 192.168.10.20
readchar: Got EOF
Remote side has terminated connection. GDBserver will reopen the connection.
Listening on port 54320
I have never used gdb remotely so maybe I am running into a beginner's issue so every response might help.
edit: My gdbserver was provided by the manufacturer of the embedded hardware.
I found out that remote-debugging a cross-compiled executable needs gdb on the host computer to be compiled for this purpuse. In my case it means that I have to use this command
/opt/microblaze-uclinux-tools/bin/microblaze-uclinux-gdb line-g
enerator.gdb
instead of simple gdb line-generator.gdb
Luckily the correct file was provided by the embedded board manufacturer!
To be honest I don't fully understand the context so if someone has an explanation on this I'd be glad to hear this!
cheers, Stefan
When I try to add it to sources as per debian install instructions I get this error. I'm guessing this means that there are no arm packages for it.
Failed to fetch https://dist.crystal-lang.org/apt/dists/crystal/InRelease Unable to find expected entry 'main/binary-armhf/Packages' in Release file (Wrong sources.list entry or malformed file)
I'm guessing I probably need to install it from source. How would I go about doing that with an arm cpu? When I check it out and run make I get the error:
You need to have a crystal executable in your path! Makefile:113:
recipe for target '.build/crystal' failed make: *** [.build/crystal]
Error 1
Any suggestions would be greatly appreciated.
EDIT: There's now a semi-official repository for crystal on raspbian, check it out here: http://public.portalier.com/raspbian
Crystal doesn't build Debian packages for ARM, and you're correct in that you'll need to build from source.
However, the Crystal compiler is written in Crystal. This presents the obvious problem of how to get a compiler to build the compiler. The answer is cross-compilation: building an arm binary on a x86 desktop computer and copying it across.
Here's a quick step-by-step based on my memory of last time I cross-compiled:
Install Crystal on a x86 desktop PC, and check it works.
Install all required libraries on the desktop and Raspberry Pi. You'll need the same LLVM version on the Raspberry Pi and desktop. This is probably the hardest and longest step. You can install llvm 3.9 from debian testing for ARM, see this stackoverflow post for how to install only LLVM from debian testing.
Check out the sources from git on both computers, and run make deps.
Cross-compile the compiler by running this command in the root of the git repository:
./bin/crystal build src/compiler/crystal.cr --cross-compile --target arm-unknown-linux-gnueabihf --release -s -D without_openssl -D without_zlib
This command will create a crystal.o file in your current directory, and also output a linker command (cc crystal.o -o crystal ...).
Copy crystal.o to the raspberry pi, and run the linker command. Be sure to edit the absolute path to llvm_ext.o so that it points to the Crystal checkout on your Raspberry Pi, not the checkout on your desktop. Also make sure that all references to llvm-config in the command are for the correct LLVM version. For example, changing /usr/local/bin/llvm-config to llvm-config-3.9 on Raspbian.
Run the crystal executable in your current directory (./crystal -v) and make sure it works.
Ensure to set CRYSTAL_PATH environment variable is set to lib:/path/to/crystal/source/checkout/src so that the compiler can find the standard library when compiling applications.
I've finished the setup of my jetson tk1 eval board and I've started to setup my Nsight Eclipse to remotely run my programs on the Jetson board.
I've created a CUDA C project in Eclipse and completed the setup and connected my board to my eclipse.
When I build the sample CUDA file locally on eclipse it's working fine but when I try to run on the remote board, I get this output :
echo $PWD'>'
/bin/sh -c "cd \"/home/ubuntu\";export LD_LIBRARY_PATH=\"/usr/local/cuda-
6.0/lib\":\${LD_LIBRARY_PATH};\"/home/ubuntu/test\"";exit
ubuntu#tegra-ubuntu:~$ echo $PWD'>'
/home/ubuntu>
ubuntu#tegra-ubuntu:~$ /bin/sh -c "cd \"/home/ubuntu\";export
LD_LIBRARY_PATH=\" /usr/local/cuda-
6.0/lib\":\${LD_LIBRARY_PATH};\"/home/ubuntu/test\"";exit
/home/ubuntu/test: 1: /home/ubuntu/test: Syntax error: ")" unexpected
logout
From the last line of output, it seems like it's an executable format error. Does anyone ever encountered something similar? I'm running out of ideas.
I managed to find the answer. The version of Eclipse I had wasn't able to correctly compile my cuda file into the ARMv7 format. So I was always uploading an x64_86 format executable file.
My solution was to create a bash script that transfers the cuda file and compile it directly on the board when I launch the run sequence from eclipse.
In the end it took a bit of programming to make things work but it's now compiling and executing correctly on the remote board.
Hello I meet the same problem. I solve these problem by delete the whole workspace and generate a new one. You can have a try.
I am new to contiki os, I tried to compile and run hello-world.c file located in examples directory in contiki os 3.0. But I got the error,
hello-world.c:40:21: fatal error: contiki.h: No such file or directory".
I tried this in root user.
Any kind of help to run very beginner program in contiki is appreciated.
Use the make command to build Contiki. Doing that invokes architecture-specific version of gcc with compiler flags pointing to the the proper header file paths:
By default, make is going to build for the "native" platform (that is, x86) and create an application image that is executable on the host PC.
To build for a specific hardware platform, set the TARGET variable. For example, to build for Tmote Sky/TelosB nodes:
make TARGET=sky hello-world
To build and run for the native platform:
make
Output:
TARGET not defined, using target 'native'
mkdir obj_native
...
CC hello-world.c
LD hello-world.native
rm hello-world.co
To run it:
./hello-world.native
Output:
Contiki-3.x-1457-g552408b started with IPV6, RPL
Rime started with address 1.2.3.4.5.6.7.8
MAC nullmac RDC nullrdc NETWORK sicslowpan
Tentative link-local IPv6 address fe80:0000:0000:0000:0302:0304:0506:0708
Hello, world
Thanks for all, who helped to answer my question. Finally, I am able to run first hello-world program in Contiki OS. I have use the following code syntax.
$cd contiki
$cd examples/hello-world
$make TARGET=native
To run the compiled code use the following code.
$ ./hello-world.native
Out put:
Contiki 3.0 started with IPV6, RPL
Rime started with address 1.2.3.4.5.6.7.8
MAC nullmac RDC nullrdc NETWORK sicslowpan
Tentative link-local IPv6 address fe80:0000:0000:0000:0302:0304:0506:0708
Hello, world
I am working with openvswitch on ubuntu 14.04 server. I can easily attach gdb with any of its binary files for debugging its various features but when it comes to its kernel module, I am not able to debug it as per my requirement.
I am using following steps to attach linux kernel with gdb:
1. gdb /tmp/vmlinux /proc/kcore
2. Adding a symbol File to GDB:
cd /sys/module/openvswitch/sections/
ls -A1
.cat .text .data .bss
3. in gdb - add-symbol-file datapath/linux/openvswitch.ko 0xf87a2000 -s .data 0xf87b4000 -s .bss 0xf87b4560
4. b vxlan_udp_encap_recv
but when I generate packets for testing ovs kernel module and step over it says "The program is not being run."
Note: I have confirmed all module symbols by running this command: nm root/ovs/_build-gcc/datapath/linux/openvswitch.ko = which prints all symbols. and lsmod also confirms the existence of ovs kernel module.
I want to make ovs module stop at specified break point after it receives a message from its user-space application on netlink socket for its detailed debugging as conveniently as it allows me to debug a user-space process. Please suggest me how do I resolve this problem or if there is any alternative. I'll be really grateful for any help or suggestion. Thank you!
To debug the kernel you need to use KGDB / KDB.
one possibility:
run the gdb server on the target machine. run gdb on another machine. recompile the target machine kernel with the -ggdb parameter on gcc. start both machines with the target machine running the kernel with all the -ggdb info. have all the source available on both machines. connect from the testing machine to the target machine. have the gdb server connect to the kernel ....