Mc-avr-notes

Aus SpaceOnEarth
Version vom 31. Dezember 2019, 12:28 Uhr von h_>Axel (Textersetzung - „ * “ durch „* “)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
I_UfE_AVR

usbprog

installation

apt-get install libusb libxml libcurl libcurl-dev wxWidgets

  • libusb to access the device,
  • libxml to parse the firmware descriptions,
  • libcurl libcurl-dev to download the firmware,readline toj simplify editing of the command line (in the CLI version),
  • wxWidgets, if you want to compile also the GUI version and
  • $ ./configure
  • $ make
  • $ su
  • $ make install
Rechte für den Adapter

if you want to use the usbprog-gui for firmware change as normal user and not as root only on a recent Linux system using udev, you can tell udev do modify permissions accordingly.

To configure udev, create a file named /etc/udev/rules.d/80-usbprog.rules with the content Code:

SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2104", GROUP="ufe", MODE="0660"

programmier Tips

AXOS geht nicht mehr/ Codelänge--ag 10:24, 28 April 2009 (UTC)

wenn man gcc option -O2 wegläßt (bzw -O0 wählt) funktioniert das axos nicht mehr.

-O2 ergab bei meinem Testprogramm den kürzesten code

How do I use a #define'd constant in an asm statement?--ag 15:14, 5 April 2009 (UTC)

eg works:

asm volatile("sbi 0x18,0x07;");
Which works. When you do the same thing but replace the address of the port by its macro name, like this:
asm volatile("sbi PORTB,0x07;");
you get a compilation error: "Error: constant value required".
PORTB is a precompiler definition included in the processor specific file included in avr/io.h. 
As you may know, the precompiler will not  touch  strings and PORTB, instead of 0x18, 
gets passed to the assembler. One way to avoid this problem is:
asm volatile("sbi %0, 0x07" : "I" (_SFR_IO_ADDR(PORTB)):);

Note:

For C programs, rather use the standard C bit operators instead, 
so the above would be expressed as PORTB |= (1 << 7). 
The optimizer will  take care to transform this 
into a single SBI instruction, assuming the operands allow for this.

Ethernet

links