I can't understand, what device-name I should use for attiny88? For example, string for my old nano was arduino:avr:nano:cpu=atmega328old
I installed cores for attiny in arduino-cli, and test this board in ArduinoIDE and it works well, but I want to use arduino-cli.
(Sorry for my English)
Found the solution, this string named as FQBN. And I can get this FQBN for all my boards after exec command arduino-cli board listall
Related
I discover the stm32f4 discovery board.
For the moment I'm able to use leds, button, and to communicate through serial port.
I'm now trying to use the Gmp library on this board.
I build the arm-none-eabi toolchain following these instructions: https://blog.tan-ce.com/gcc-bare-metal/
I configure Gmp with the following options:
./configure CC=arm-none-eabi-gcc CFLAGS="-nostartfiles --specs=nosys.specs -g" --host=arm-none-eabi --disable-assembly
My project compiles and links without any issue, but
when I try to initialise an mpz_t on the board with the following code:
mpz_t a;
mpz_init_set_str(a, "31", 10);
I fall into the HardFault_Handler (), my arm-none-eabi-gdb gives me:
(gdb) bt
#0 HardFault_Handler () at ./src/stm32f4xx_it.c:34
#1 <signal handler called>
#2 0x08016ade in __gmpn_fft_best_k (n=134358201, sqr=134358201) at mul_fft.c:151
#3 0x0801816e in __gmpn_mul_fft (op=0x80006f5 <HardFault_Handler>, pl=134219497, n=0x8022471 <Reset_Handler>, nl=537001984, m=0x80224b9 <WWDG_IRQHandler>, ml=134358201, k=134358201) at mul_fft.c:870
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
If someone has already run Gmp on a microcontroller I am very interested in the way to do it !
I finally found the solution, the cortex type must be specified.
For the stm32f4, add -mcpu=cortex-m4 to the CFLAGS solve the problem.
I use the toolchain available here: arm-none-eabi toolchain
The whole configuration command is:
./configure CC=arm-none-eabi-gcc CFLAGS="-nostartfiles --specs=nosys.specs -mcpu=cortex-m4" --host=arm-none-eabi --disable-assembly --prefix=your-bare-metal-gmp-location
where "your-bare-metal-gmp-location" is the installation directory (you must not install a bare metal library in the classical /usr/local).
I have looked at a dozen different ways to reset my arduino, from connecting pins to the reset pin and jury rigging weird bits of code.
None of them work.
The one bit of code that everybody seems to be using is
void software_Reset() // Restarts program from beginning but does not reset the peripherals and registers
{
asm volatile (" jmp 0");
}
To which my arduino responds with
C:\Users\Leonardo\AppData\Local\Temp\ccGUYdTQ.s:2259: Error: bad
instruction `jmp 0'
And it then fails uploading the code. I don't know what to do. My full code can be found here http://pastebin.com/CA2Ms2hB but it's huge and I'm not sure if it will be of help.
If anyone could help me understand why software_Reset(); I would really appreciate it, I'm at the end of my rope here.
(also if you have other methods to reset arduino I'll gladly try them)
On ARM based microcontrollers you can call NVIC_SystemReset().
All ARM based microcontrollers are required to implement that.
This is useful because resetFunc() at address 0 may not work on newer ARM based microcontrollers.
I think you are trying to write assembly code in your arduino code editor.
Let me tell you one thing. Arduino code editor does not support assembly language code by default. You can write assembly language code in arduino code editor by going through the process mentioned below:
Caution: We will be modifying the arduino source code to do that.
Get the source code for Arduino IDE: https://github.com/arduino/arduino
Extract the downloaded zip file, you will get a folder named Arduino-master
Open the Sketch.java file in a text editor of your choice. The location of sketch.java is : Arduino-master/app/src/processing/app/Sketch.java
Insert the .s capability:
a. Search for: sc.isExtension("c");
you will see something like this:
//3. then loop over the code[] and save each .java file
for (SketchCode sc : code){
if(sc.isExtension("c") || sc.isExtension("cpp") || sc.isExtension("h")){
//no pre-processing services necessary for java files
b. Add sc.isExtension("s") at the end of the if condition. Now your code should look like below:
//3. then loop over the code[] and save each .java file
for (SketchCode sc : code){
if(sc.isExtension("c") || sc.isExtension("cpp") || sc.isExtension("h") || sc.isExtension("s")){
//no pre-processing services necessary for java files
Search for: String[] getExtensions()
You will see some code like this:
/**
* Returns a String[] array of proper extensions.
*/
public String[] getExtensions() {
return new String[] { "ino", "pde", "c", "cpp", "h" };
}
Insert "s" in the returned Array. So, now your code should look like this:
/**
* Returns a String[] array of proper extensions.
*/
public String[] getExtensions() {
return new String[] { "ino", "pde", "c", "cpp", "h", "s" };
}
Save Sketch.java
Open Compiler.java in text editor of your choice. The location of Compiler.java is: Arduino-master/app/src/processing/app/debug/Compiler.java
Search for: compileFiles(
In the command findFilesInFolder(), replace the capital S with a lowercase s.
Repeat step 8 : 3 times more... (4 tiems in total)
Save the Compiler.java file
Download the latest version of java SE 8u111 from http://www.oracle.com
Download and install any java command line tool. But I would recommend Apache ANT.
If you are a windows user:
You can download it here: http://ant.apache.org/
More help on download and install on windows: https://www.mkyong.com/ant/how-to-install-apache-ant-on-windows/
If you are a Mac user:
You need to install it using Homwbrew:
To install Homebrew:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
And then to install Apache ANT:
brew install ant
In Command line go to the directory for Arduino-master/build
Build the Arduino IDE using : ant build, which should end with Build Successful message.
Package the Arduino IDE using: ant dist
It will ask you to enter a version number and give a suggestion e.g.[0105]. Just enter the suggested number with dots and asm. For example: If suggestion is [0105] then enter: 1.0.5.asm
This command may take 6 - 10 minutes to finish. (depending on the speed of your computer)
Then you must get Build Successful!!!
The Arduino IDE that supports assembly language programming can be found in the newly created .zip file
Unzip the file and install the Arduino IDE application.
Now, you should be able to write assembly programs without getting errors in the Arduino IDE.
If you have any problems, Please feel free to ask.
I am pretty new to MPI and Intel Pin. I already installed pin-2.13-62732-gcc.4.4.7-linux on my linux environment, I need t use this tool on MPI codes. foreexample I want to get the number of instruction(such as inscount0 which is already existed in pin) of MPI code (like imul.c). Would you tell me what I can do?
The least painful way I found is to use tau_pin. https://www.cs.uoregon.edu/research/tau/docs/old/re39.html
You can start analysis of your MPI application following way:
mpirun –np $NPROCS pin -t $PIN_TOOL -- $APP
It the same as in case of Valgrind: Using valgrind to spot error in mpi code
I am am unable to get avr-elf-windows and WinAVR to work. I have managed to build the example supplied with avr-elf-windows (ATmega2560). But if I try and expand to use another chip or start using the WinAVR supplied packages and projects I keep getting errors I cannot work out.
Method 1:
Modify the ATmega2560 example to use the WinAVR packages.
Changed:
with Atmega2560; use Atmega2560;
to:
with AVR; use AVR;
with AVR.Atmega328p; use AVR.atmega328p;
Create a project file to include:
with "C:\WinAVR-20100110\lib\gnat\avr.gpr";
with "C:\WinAVR-20100110\lib\gnat\avr_app.gpr";
Running make I get the following error:
avr-gnatmake: "C:\WinAVR-20100110\lib\gnat\avr_lib\avr-int_img.adb" compilation error
Great, I have a compilation issue, but I cannot see the error.
Method 2:
Open the above project file in GPS. Change the build setting to be gnatmake. GPS now starts reporting errors and warnings:
Project warning: object directory "avr_lib/avr5/obj" not found
Project library directory "C:\WinAVR-20100110\lib\gnat\avr_lib\avr5\lib\" does not exist
The latter issue is very clearly the fact that I have not set up GPS correctly to tell it the values of microcontroller and architecture, but I cannot seem to find anything to resolve this.
Method 3:
To use the WinAVR set up directly using makefiles which then gives me the error:
avr-gnatmake: RTS path not valid: missing adainclude and adalib directories
If I follow the instructions I can find by searching the web I can only find details for building the required libraries under Linux.
Platform: Windows 7.
With the combination of the two answers above I have now managed to link my sample code. As to wether it will work on the Arduino, that is a different issue.
Many thanks for the help.
I have found it a bit frustrating to get this far, and I wonder if there are others out there who may just give up on Ada on the Arduino and go back to the Arduino IDE and therefore missing out on the opportunity to learn a language with more structure. There are many misleading pages out there that also do not help.
You might want to take a look in the paper Integrating 8-bit AVR Micro-Controllers in Ada. Basically you can use a GPS project file arduino.gpr like
project Arduino is
for Source_Dirs use (".", "src");
for Object_Dir use "obj";
for Exec_Dir use "bin";
for Main use ("main.adb");
package Compiler is
for Default_Switches ("ada") use ("-mmcu=avr5");
end Compiler;
package Ide is
for Gnat use "avr-gnat";
for Gnatlist use "avr-gnatls";
for Debugger_Command use "avr-gdb";
end Ide;
package Builder is
for Executable_Suffix use ".elf";
for Default_Switches ("ada") use ("--RTS=rts-zfp");
end Builder;
package Linker is
for Default_Switches ("ada") use ("obj\crtm328p._o", "-nostdlib", "-lgcc", "-mavr5", "-Tdata=0x00800200", "-mmcu=avr5");
end Linker;
end Arduino;
and you can code a spec for your ATmega328P like
with Interfaces; use Interfaces;
with System;
package ATmega328P is
-- PORTB: Port B Data Register
PORTB : Unsigned_8;
for PORTB'Address use System'To_Address (16#25#);
-- DDRB: Port B Data Direction Register
DDRB : Unsigned_8;
for DDRB'Address use System'To_Address (16#24#);
-- PINB: Port B Input Pins
PINB : Unsigned_8;
for PINB'Address use System'To_Address (16#23#);
end ATmega328P;
to be imported by your main file or libraries.
Bear with me if this isn't the immediate answer; I have only used the AVR-Ada toolchain on Linux, so we may have to iterate towards a solution unless someone else spots the problem first.
The first thing to decipher is which version of the AVR-Ada tools you have:
your project file USED to need (using avr-ada 1.1)
with "C:\WinAVR-20100110\lib\gnat\avr.gpr";
Now with avr-ada 1.2.1 you need (instead)
with "C:\WinAVR-20100110\lib\gnat\avr_app.gpr";
for building applications, and <same path>/avr_lib.gpr for libraries.
I don't believe you ever need both! And they may conflict with each other.
I don't know the state of the Windows binary build, but if you need the latest version (recommended : it's a real improvement) you may need to build it from source.
Method 1 : were you running Make from a command line? If so, I would expect to see errors in all their gory details.
Method 2 : can't help you here, I don't know GPS well enough. However I can say that on Linux there are no "avr5" folders in [wherever]/avr/lib/gnat/avr_lib. (AVR5 is correct for the 328p)
Instead there IS a [wherever]/avr/lib/avr5 containing libc and other C-related objects - including the crtm328p.o that Rego names in his linker switches, and a [wherever]/lib/gcc/avr/4.7.2/avr5 folder containing libgcc.a. You probably need to find the former and point GPS at it...
Method 3 : This looks the easiest to fix. The "gnatmake" command needs an --RTS= option pointing at the correct RTS for the 328p. This should be --RTS=rts/avr5 assuming the RTS is correctly installed.
Alternatively a full path ought to work. Here, that would be
--RTS=/opt/avr_472_gnat/lib/gcc/avr/4.7.2/rts/avr5
on Windows you may have to poke around to find the correct path.
Using Method 1 this --RTS option is automatically generated by avr_app.gpr.
It appears that having a mix of 3 or 4 tool chains installed that provide one of aspects of WinAvr, AvrAda causes significant problems (these included WinAvr, Avr-Ada, Cygwin, AVR compiler by Adacore and MinWG).
Starting with a brand new Win7 or Win8 installation perform the following:
Install WinAVR-20100110 to C:\WinAVR-20100110
Copy the content of the Avr-Ada-1.2.0_bin to C:\avr-ada-1.2.0
Add C:\avr-ada-1.2.0\bin to the PATH
Compiling the content of each of the examples in C:\avr-ada-1.2.0\share\doc\avr-ada\apps identifies that some DLLs are missing: libiconv-2.dll, libgmp-10.dll, libmpc-2.dll, libmpfr-1.dll
These can be found in a MinGW installtion.
Create a virtual machine to install MinGW on, in order to ensure it did not mess with the main PC.
Copy the missing DLLs in C:\WinAVR-20100110\bin
The example in DS1820 will not compile due to crc_lib being missing.
In order to upload to the Arduino the makefiles must be modified for your local installation, board type etc.
I hope this exact issue was not addressed already. I did search for a while.
So I'm using the Arduino library for Processing, testing it by simply having it blink an LED that I have connected to my Arduino UNO. I'm following this tutorial, but am having a problem a little different than the ones covered on that tutorial page. Here's my Processing code:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 13;
void setup()
{
//println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[0], 57600); //error here
arduino.pinMode(ledPin, Arduino.OUTPUT);
}
void draw()
{
arduino.digitalWrite(ledPin, Arduino.HIGH);
delay(1000);
arduino.digitalWrite(ledPin, Arduino.LOW);
delay(1000);
}
Here's my error:
IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Exception in thread "Animation Thread" java.lang.IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
at cc.arduino.Arduino$SerialProxy.<init>(Arduino.java:119)
at cc.arduino.Arduino.<init>(Arduino.java:168)
at sketch_130206a.setup(sketch_130206a.java:29)
at processing.core.PApplet.handleDraw(PApplet.java:2117)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
at processing.core.PApplet.run(PApplet.java:2020)
at java.lang.Thread.run(Thread.java:680)
Since my error apparently has to do with access permissions, I tried doing what it says at the tutorial page I was following by going to /var/lock folder, but the /lock folder doesn't exist! I'm using a Mac 10.8.2. I searched around and found this thread (arduino dot cc/forum/index.php?topic=135164.0) and decided to try "sudo mkdir -p /var/lock" and "sudo chmod 777 /var/lock" in terminal, but it didn't change the error I have in Processing, even after restarting it. I also tried opening the Arduino app and uploading the StandardFirmata sketch as mentioned at the ProcessngxArduino library download page (playground.arduino dot cc/interfacing/processing) while trying to run the processing sketch, but same error. The fact that I'm using the Arduino UNO instead of the Duemilanove shouldn't be the issue as the UNO is apparently just an updated version of it. Any ideas what I could try to do next?
UPDATE: Okay so the highlighted error in my code is what opens the serial port I'm using at whatever rate (57600 bits/sec in this case I think). So I think the problem lies in this particular step in the instructions at the adrunio x processing info page mentioned earlier(playground dot arduino dot cc/interfacing/processing), step 3: "Configure Processing for serial: processing dot org/reference/libraries/serial/"... the link goes to processing's 'serial' reference page. I'm confused about what is meant by "configure"? How exactly do I figure out my "correct serial port"? I went through the rest of the instructions and the examples on the serial reference page, and still have no idea what I'm looking for.
UPDATE #2: My serial port for the arduino is "/dev/tty.usbmodem1411". I am still confused about how to plug this in to my code in Processing though. The things I just learned in these last 2 updates might be irrelevant to my error, I'm still unsure.
The problem was that I was using the beta version of Processing (2.0). Use the latest stable version (1.5.1) and it should work.