Arduino IDE doesn't find sys/time.h in Windows - c

I'm trying to follow this tutorial to start testing my new Adafruit Azure IoT starter Kit that comes with an Arduino Feather M0 Wifi. I was able to setup the Arduino IDE 1.8.4 (From Windows Store) on my PC which is a Windows 10. In the step 1.8 (Build Your Remote Monitoring Sample), when I try to compile the solution "remote_monitoring.ino" dowonload from here, it appears the following error:
C:\iot-hub-c-m0wifi-getstartedkit-master\remote_monitoring\remote_monitoring.ino:12:22:
fatal error: sys/time.h: No such file or directory
#include <sys/time.h>
compilation terminated.
exit status 1 Error compiling for board Arduino/Genuino Uno.
It seems like in Windows, including sys/time.h just doesn't Works, but if I try to delete the sys/ part, it comes the following error:
C:\Users\jonguz\OneDrive -
Microsoft\Documents\Arduino\libraries\AzureIoTHub\src/sdk/serializer.h:42:19:
fatal error: cstdlib: No such file or directory
#include <cstdlib>
I appreciate your help.

sys/time.h and cstdlib are located in the toolchain used by the Adafruit SAMD Boards hardware package (specifically arm-none-eabi-gcc). The files in this tool are only added to the include search path when a board that uses that tool is selected in the Tools > Board menu. If you don't have one of those boards selected then the file will not be found, thus the error messages you encountered.
From https://learn.adafruit.com/adafruit-feather-m0-wifi-atwinc1500/using-with-arduino-ide:
Select the matching board, the current options are:
Feather M0 (for use with any Feather M0 other than the Express)
So the solution is to select Tools > Board > Adafruit Feather M0 after installing Adafruit SAMD Boards via Boards Manager but before compiling the sketch.

one can find a header-only Windows implementation of the <sys/time.h> header on GitHub here:
https://github.com/win32ports/sys_time_h
side note: RTC time implementations for the ESP32 can be found here:
https://github.com/kerikun11/ESP32Time
and here:
https://github.com/fbiego/ESP32Time

Related

How to "Command not supported" in keil uvision 5.30 for STM32F4

I'm using STM board STM32F407VG with the ide KEIL MDK5.30. I have tried to flash the basic blinky example to the board. After building the code with 0 error and warning clicked on the download button to flash to the board. At that time an dialogue box popping out with a message "Command not supported". After that the process is failed with a message "Error: Flash Download failed - Target DLL has been cancelled".
ST-link is detected by the IDE (ST-LINK/V2-1).
What exactly need to be done here to solve this issue?
(In a different forum I found a fix like download the previous version MDK and copy the C:\Keil_v5\ARM\STLink\ST-LINKIII-KEIL_SWO.dll DLL file from the installation folder of previous version MDK to the corresponding folder of latest using MDK.
It will be helpful if anybody shares how to get the previous version MDK)
I have the same problem.
Try this way.
Open Pack Installer program.
Find Packs.
Device Specific -> Keil::STM324xx_DFP.
Remove the latest version.
Install previous version (like 2.12.0(2018-02-22) version).

Mplabx 5.15 on Ubuntu 18.04 can not use ICD 3

I keep getting this error with ICD 3 when attempting self test:
Could not connect to the selected hardware tool. Please make sure the tool is not being used by another project in MPLAB X.
The device works fine under Ubuntu 12.04. Mplab can see the ICD3 device because it gets the correct serial number. lsusb reports the same values that Mplab reports as well. I tried running Mplab as root and that made no difference - this is not a permissions problem.
I tried this solution: https://www.microchip.com/forums/m1051283.aspx but it did not work. I also tried to close all projects so I had in the projects bar, and got the same error.
I tried the udevadm as suggested by this comment: https://www.microchip.com/forums/m1083236.aspx an it shows Mplab is trying to talk to the ICD 3:
$ udevadm monitor --property
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[3219.382129] bind /devices/pci0000:00/0000:00:16.2/usb3/3-1/3-1:1.0 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-1/3-1:1.0
DEVTYPE=usb_interface
DRIVER=usbfs
INTERFACE=255/0/0
MODALIAS=usb:v04D8p9009d0100dcFFdsc00dp00icFFisc00ip00in00
PRODUCT=4d8/9009/100
SEQNUM=3378
SUBSYSTEM=usb
TYPE=255/0/0
UDEV [3219.387110] bind /devices/pci0000:00/0000:00:16.2/usb3/3-1/3-1:1.0 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-1/3-1:1.0
DEVTYPE=usb_interface
DRIVER=usbfs
ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class
ID_VENDOR_FROM_DATABASE=Microchip Technology, Inc.
INTERFACE=255/0/0
MODALIAS=usb:v04D8p9009d0100dcFFdsc00dp00icFFisc00ip00in00
PRODUCT=4d8/9009/100
SEQNUM=3378
SUBSYSTEM=usb
TYPE=255/0/0
USEC_INITIALIZED=3219386787
A few seconds later it unbinds. So far I'm just hearing crickets on the Microchip forum. Anyone else tried using ICD 3 under Ubuntu 18?
Mike
After much head beating, I found that there were a lot of .jar files in the microchip mplab directory. But Java was not installed on my version of Ubuntu. After installing openjdk (and placing the correct device for loop back) I got MPLAB to talk to the ICD 3.
I am really surprised this was not obvious. If you have any MPLAB problems under Ubuntu 18.04, check if java is installed! (sudo apt install default-jre)

Arduino - Robot Car Kit with NewPing.h library

I downloaded the NewPing.h library and included them in the arduino library folder but I still getting this error:
N:\Arduino\avoi\avoi.ino:3:21: fatal error: NewPing.h: No such file or directory
#include <NewPing.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
Go to the Arduino IDE, in the top go to Sketch -> Include Library -> Manage Libraries...
Then search for NewPing, and install the only one that shows.
After that you're done you can use the header like so:
#include <NewPing.H>
Hope it helps.
To check the correct syntaxis go to Arduino IDE > File > Examples and search for newping examples (they will appear if newping library is installed) if not go to Sketch > Include Library > Manage Libraries > Search for newping > install

Error with stty and STM32F4-DISCO (fourQ-package)

I recently downloaded the v3 of the FourQlib [1], build the FourQlib and wanted to test if everything went well.
First of all, my system:
Windows 10 (host) with MinGW, ARM Toolchain, MSYS, ...
Ubuntu 16.04 LTS (Guest) (gcc, arm toolchain, ...)
VirtualBox
STM32F429ZI-Disco
The source [1] includes the directory "FourQ_ARM", when compiling you have to start the "monitor.sh" [2] file in a terminal. Since they (Longa et al.) link to "ttyUSB0" I'll checked, if there is any device registered in Ubuntu. Since my µC ist registered as "stlinkv2_2 I changed this symbolic link "/dev/ttyUSB0 -> /dev/stlinkv2_2".
If I run the monitor.sh, the beginning will turn me in an error:
stty -F /dev/stlinkv2_2
leads to the error "Vorgang nicht zulässig" which means something like "Operation not allowed"
Could someone explain me, why I get this error and how to get this shell-script work?
[1] https://github.com/Microsoft/FourQlib
[2] https://github.com/Microsoft/FourQlib/blob/master/FourQ_ARM/tests_Cortex-M4/monitor.sh
The solution is: Using extra hardware with an old driver. Using TTL to USB-converter.
If someone needs to use the FourQlib on a STM32F407, use their USART and monitoring tools. On different processors you need to choose different USART pins. Those with a display connected allready use those pins.

Not able to upload code on CC2538dk board from Ubuntu 12.04 command line

I have a CC2538dk board. I am using Ubuntu 12.04 and cloned Contiki repository from github. I was able to compile all the code in Contiki using make TARGET=cc2538dk hello-world, but I'm not able to upload the code to the CC2538dk board from command line.
The error I'm getting when I ran make TARGET=cc2538dk hello-world.upload is as below.
make: No rule to make target `hello-world.upload'. Stop.
I used to use TI's Uniflash tool (CCS_Uniflash v2.2) to upload the the .elf binary, but it is not available in Contiki.
There is no make target for uploading to CC2538dk boards. According to the documentation one should use TI's UniFlash.
I had success compiling the contiki examples on a separate computer, then using Code Compose Studio v 5.4 to import my binaries (ELF files) to an empty CC2538 project, then debug it from there in order to get it loaded onto the board. Definitely not ideal, but it works.
Setup:
Compile contiki source and examples from instantContiki
move the example directory, included blink.elf to windows machine with CCS 5.4 installed
make a new project in CCS, select Other Examples->Empty CC2538 Project
Import a C/C++ executable, then using the GNU Elf reader, select the blink.elf file you moved over
copy+paste the CC2538SF53.ccxml and the cx2538xf53_ccs.cmd to the new project, and try to debug using those configurations.
The reason this seems to work is that the xds100v3 drivers that come with the board's install disc and the uniflash tool don't seem to work right and just give me any number of errors. There's a black-magic-configuration-combination of the CCS 5.4 for Window's drivers/Other Example's CC2538SF53.ccxml that was the only way I was able to connect to the target.

Resources