Forum > Embedded - AVR
Cross compiling installation for AVR
process_1:
https://wiki.freepascal.org/AVR
This guide is quite a bit obsolete now as the Atmel link which provides bintuils binaries is broken. I believe we all know that Atmel is sold to Microchip several years ago...
- What would be exact steps to install cross-compiler for AVRs ?
- Is it possible to precisely debug the code, regarding to shosen AVR model and crystal frequency in order to get precise cpu cycles count and variable values?
trev:
I replaced the Atmel links with Microchip links.
d.ioannidis:
Hi,
--- Quote from: process_1 on July 23, 2020, 11:35:06 am ---< snip >
- Is it possible to precisely debug the code, regarding to shosen AVR model and crystal frequency in order to get precise cpu cycles count and variable values?
--- End quote ---
Yes it is.
I'm able to debug physical AVR MCU's with Lazarus . I can set breakpoints, step in, step out, see variables.
The only limitation currently, is that this is possible only with the use of Atmel Studio backend tools. No Linux or MacOS support ( for the tools ) until someone implement a gdb proxy for the mplab debugger which support Windows, Linux and MacOS. One workaround is to use a VM to host those tools and run Lazarus from MacOS and/or Linux which works.
As for debuggers, unfortunately the low price non HV programmer / debugger SNAP ( ~ 20€ ) is not supported yet in the Atmel Studio backend. AFAIK, it's scheduled for addition at Q3 / Q4 this year . But you can use an xplained board ( look for those with an AVR mcu ), which have a debugger mcu on board specific for that board mcu.
Personal, I'm using a "custom" mEDBG debugger derived from the Xplained Yourself project. BTW, if you're only using mcu's with UPDI debug interface you could use a pro micro with some modifications as per the mcudude's microUPDI.
PS: Maybe I should create a tutorial on how to setup such enviroment.
regards,
ccrause:
--- Quote from: process_1 on July 23, 2020, 11:35:06 am ---- Is it possible to precisely debug the code, regarding to shosen AVR model and crystal frequency in order to get precise cpu cycles count and variable values?
--- End quote ---
You can use avr-gdb and debug in Lazarus - for this you either need debugging hardware as per Dimitrios's post (for debugwire there are a couple of projects to easily hook up via a usb-serial dongle, search for debugwire on Github), or connect to a simulator/emulator (simavr, fp-avrsim, or qemu). This will allow you to step through code, stop and inspect variables, memory, registers etc.
The easy way to get cycle counts is to use either Atmel Studio or MPLAB X. I've once tested an FPC compiled project in MPLAB X and it worked OK, but I stopped using it because it was frustratingly slow on my computer. The simulators listed above should also have cycle counters, but I haven't explored it myself.
process_1:
First of all, thank you all.
Hopefully, I have account on Microchip, thus had no issue to download required file avr8-gnu-toolchain-3.6.2.1759-linux.any.x86_64.tar.gz for toolchain.
In ~/.bashrc I have added this line:
export PATH=/usr/avr8-gnu-toolchain-linux_x86_64/bin:$PATH
Then restarted the system and executed this script I have made previously:
FPC_CrossLink_AVR
--- Code: ---#!/bin/sh
sudo cp avr8-gnu-toolchain-3.6.2.1759-linux.any.x86_64.tar.gz /usr
cd /usr
sudo tar zvxf avr8-gnu-toolchain-3.6.2.1759-linux.any.x86_64.tar.gz
sudo rm avr8-gnu-toolchain-3.6.2.1759-linux.any.x86_64.tar.gz
sudo apt install avrdude
cd /usr/share/fpcsrc/3.2.0
sudo make clean all OS_TARGET=embedded CPU_TARGET=avr
sudo make crossinstall OS_TARGET=embedded CPU_TARGET=avr INSTALL_PREFIX=/usr SUBARCH=avr5
sudo ln -sf /usr/lib/fpc/3.2.0/ppcrossavr /usr/bin/ppcrossavr
--- End code ---
All passed well, but at end this error is shown:
system.pp(325) Error: Assembler avr-embedded-as not found, switching to external assembling
Indeed there is no avr-embedded-as inside /usr/avr8-gnu-toolchain-linux_x86_64/bin, just avr-as which is required file or not?
If it is, then symbolic link will do the rest, I believe...
Navigation
[0] Message Index
[#] Next page