Recent

Author Topic: AVRPascal – free code editor for FPC for AVR  (Read 10126 times)

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #15 on: October 23, 2024, 07:36:59 pm »
It is also odd that your output shows that 75 lines were compiled, is there extra code, or just extra empty lines in the source?
Yes, my extra-code is {$define FPC_MCU_ATMEGA328P}, probably unnecessary.
Maybe version (commit) that I use in AVRPascal is defective? I changed the compiler in july, so the commit is somewhat earlier.
I remember problems compiling any code for ATTiny13... it was impossible, unlike FPC 3.2.2. Anyway, I will download the latest FPC commit and check the result.

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: AVRPascal – free code editor for FPC for AVR
« Reply #16 on: October 23, 2024, 09:25:01 pm »
It is also odd that your output shows that 75 lines were compiled, is there extra code, or just extra empty lines in the source?
Yes, my extra-code is {$define FPC_MCU_ATMEGA328P}, probably unnecessary.
The FPC_MCU_XXX macro should be defined by the compiler based on the microcontroller specified with the -Wp command line option. Only in special circumstances would it make sense not to specify the microcontroller to the compiler.

Quote
Maybe version (commit) that I use in AVRPascal is defective? I changed the compiler in july, so the commit is somewhat earlier.
I remember problems compiling any code for ATTiny13... it was impossible, unlike FPC 3.2.2. Anyway, I will download the latest FPC commit and check the result.
Can you show the compiler command line used to compile the code for attiny13? Also enable verbose output (-va) and attach the output as text, this will show a lot of information that can help identify the issue.

PS: Try to copy/paste text based information as text, it is impossible to quote information in a picture.

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #17 on: October 24, 2024, 08:01:15 am »
PS: Try to copy/paste text based information as text, it is impossible to quote information in a picture.

First of all, thanks for the examples of compilation results. It's a good reference. I downloaded the latest FPC sources, compiled them and initially the results were not better. It turned out that some parameters were missing during the compilation of system.pp. Now the result is better but not perfect yet:

Code: [Select]
Free Pascal Compiler version 3.3.1 [2024/10/23] for avr
Copyright (c) 1993-2024 by Florian Klaempfl and others
Target OS: Embedded
Compiling C:\Programs\avr\avrpascal\examples\ccrause_blink.pas
Assembling blink
Linking C:\Programs\avr\avrpascal\examples\ccrause_blink
73 lines compiled, 0.3 sec, 354 bytes code, 3 bytes data

My compilation parameters for system.pp :

Code: [Select]

C:\Programs\avr\avrpascal\bin\x86_64-win64\pp.exe -n -Fu"C:\Programs\avr\avrpascal\rtl\avr" -Fu"C:\Programs\avr\avrpascal\rtl\embedded" -FU"C:\Programs\avr\avrpascal\lib\avr" -vwni -O3 -dRELEASE -CpAVR5 -Sm -dF_CPU:=16000000 -XPavr- @"C:\Programs\avr\avrpascal\rtl\embedded\system.cfg" -Us "C:\Programs\avr\avrpascal\rtl\embedded\system.pp"


Some parameters are probably still absent. This is certainly the cause of my earlier problems with the size of the resulting binaries and unused code.




ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: AVRPascal – free code editor for FPC for AVR
« Reply #18 on: October 24, 2024, 09:57:11 am »
I downloaded the latest FPC sources, compiled them and initially the results were not better. It turned out that some parameters were missing during the compilation of system.pp. Now the result is better but not perfect yet:

Code: [Select]
Free Pascal Compiler version 3.3.1 [2024/10/23] for avr
Copyright (c) 1993-2024 by Florian Klaempfl and others
Target OS: Embedded
Compiling C:\Programs\avr\avrpascal\examples\ccrause_blink.pas
Assembling blink
Linking C:\Programs\avr\avrpascal\examples\ccrause_blink
73 lines compiled, 0.3 sec, 354 bytes code, 3 bytes data

My compilation parameters for system.pp :

Code: [Select]

C:\Programs\avr\avrpascal\bin\x86_64-win64\pp.exe -n -Fu"C:\Programs\avr\avrpascal\rtl\avr" -Fu"C:\Programs\avr\avrpascal\rtl\embedded" -FU"C:\Programs\avr\avrpascal\lib\avr" -vwni -O3 -dRELEASE -CpAVR5 -Sm -dF_CPU:=16000000 -XPavr- @"C:\Programs\avr\avrpascal\rtl\embedded\system.cfg" -Us "C:\Programs\avr\avrpascal\rtl\embedded\system.pp"


Some parameters are probably still absent. This is certainly the cause of my earlier problems with the size of the resulting binaries and unused code.

I normally build the cross compiler and RTL from git source with the default make script, so all options are defaults (-O2 etc.).  Could be a problem with the linker?  Could you attach the compiled blink elf file, that should clearly show what is in the final executable.  Include debug info (-gw3) when compiling the blink example.  Alternatively generate a disassembled view of the binary (avr-objdump.exe -S blink.elf > blink.lss).

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #19 on: October 24, 2024, 11:14:41 am »
Alternatively generate a disassembled view of the binary (avr-objdump.exe -S blink.elf > blink.lss).
Code: [Select]

ccrause_blink.elf:     file format elf32-avr


Disassembly of section .text:

00000000 <ATMEGA328P_ss__FPC_START>:
   0: 0c 94 34 00 jmp 0x68 ; 0x68 <ATMEGA328P_ss__FPC_INIT_ZEROREG_SP>
   4: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
   8: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
   c: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  10: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  14: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  18: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  1c: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  20: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  24: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  28: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  2c: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  30: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  34: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  38: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  3c: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  40: 0c 94 4f 00 jmp 0x9e ; 0x9e <PsBLINK_ss_TIMER0OVERFLOW>
  44: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  48: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  4c: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  50: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  54: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  58: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  5c: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  60: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>
  64: 0c 94 b0 00 jmp 0x160 ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>

00000068 <ATMEGA328P_ss__FPC_INIT_ZEROREG_SP>:
  68: 11 24        eor r1, r1
  6a: ef ef        ldi r30, 0xFF ; 255
  6c: ed bf        out 0x3d, r30 ; 61
  6e: e8 e0        ldi r30, 0x08 ; 8
  70: ee bf        out 0x3e, r30 ; 62

00000072 <ATMEGA328P_ss__FPC_COPY_DATA>:
  72: a0 e0        ldi r26, 0x00 ; 0
  74: b1 e0        ldi r27, 0x01 ; 1
  76: d1 e0        ldi r29, 0x01 ; 1
  78: e2 e6        ldi r30, 0x62 ; 98
  7a: f1 e0        ldi r31, 0x01 ; 1
  7c: 02 c0        rjmp .+4      ; 0x82 <ATMEGA328P_ss__FPC_COPY_DATA+0x10>
  7e: 05 91        lpm r16, Z+
  80: 0d 93        st X+, r16
  82: a2 30        cpi r26, 0x02 ; 2
  84: bd 07        cpc r27, r29
  86: d9 f7        brne .-10      ; 0x7e <ATMEGA328P_ss__FPC_COPY_DATA+0xc>
  88: a2 e0        ldi r26, 0x02 ; 2
  8a: b1 e0        ldi r27, 0x01 ; 1
  8c: d1 e0        ldi r29, 0x01 ; 1
  8e: 0c 94 4a 00 jmp 0x94 ; 0x94 <ATMEGA328P_ss__FPC_COPY_DATA+0x22>
  92: 1d 92        st X+, r1
  94: a3 30        cpi r26, 0x03 ; 3
  96: bd 07        cpc r27, r29
  98: e1 f7        brne .-8      ; 0x92 <ATMEGA328P_ss__FPC_COPY_DATA+0x20>

0000009a <ATMEGA328P_ss__FPC_JMP_MAIN>:
  9a: 0c 94 80 00 jmp 0x100 ; 0x100 <PASCALMAIN>

0000009e <PsBLINK_ss_TIMER0OVERFLOW>:
  9e: af 93        push r26
  a0: 3f 93        push r19
  a2: 2f 93        push r18
  a4: 1f 92        push r1
  a6: 0f 92        push r0
  a8: 0f b6        in r0, 0x3f ; 63
  aa: 0f 92        push r0
  ac: 11 24        eor r1, r1
  ae: 20 91 00 01 lds r18, 0x0100 ; 0x800100 <__data_start>
  b2: 23 95        inc r18
  b4: 20 93 00 01 sts 0x0100, r18 ; 0x800100 <__data_start>
  b8: 20 91 00 01 lds r18, 0x0100 ; 0x800100 <__data_start>
  bc: 30 91 02 01 lds r19, 0x0102 ; 0x800102 <__data_end>
  c0: 32 17        cp r19, r18
  c2: 08 f0        brcs .+2      ; 0xc6 <PsBLINK_ss_TIMER0OVERFLOW+0x28>
  c4: 0a c0        rjmp .+20      ; 0xda <PsBLINK_ss_TIMER0OVERFLOW+0x3c>
  c6: 20 91 25 00 lds r18, 0x0025 ; 0x800025 <_stack_top+0x7ff726>
  ca: a0 e2        ldi r26, 0x20 ; 32
  cc: 3a 2f        mov r19, r26
  ce: 23 27        eor r18, r19
  d0: 20 93 25 00 sts 0x0025, r18 ; 0x800025 <_stack_top+0x7ff726>
  d4: 21 2d        mov r18, r1
  d6: 20 93 00 01 sts 0x0100, r18 ; 0x800100 <__data_start>
  da: 0f 90        pop r0
  dc: 0f be        out 0x3f, r0 ; 63
  de: 0f 90        pop r0
  e0: 1f 90        pop r1
  e2: 2f 91        pop r18
  e4: 3f 91        pop r19
  e6: af 91        pop r26
  e8: 18 95        reti

000000ea <PsBLINK_ss_INIT>:
  ea: 20 91 24 00 lds r18, 0x0024 ; 0x800024 <_stack_top+0x7ff725>
  ee: 20 62        ori r18, 0x20 ; 32
  f0: 20 93 24 00 sts 0x0024, r18 ; 0x800024 <_stack_top+0x7ff725>
  f4: 20 91 25 00 lds r18, 0x0025 ; 0x800025 <_stack_top+0x7ff726>
  f8: 20 62        ori r18, 0x20 ; 32
  fa: 20 93 25 00 sts 0x0025, r18 ; 0x800025 <_stack_top+0x7ff726>
  fe: 08 95        ret

00000100 <PASCALMAIN>:
 100: 0e 94 75 00 call 0xea ; 0xea <PsBLINK_ss_INIT>
 104: a4 e1        ldi r26, 0x14 ; 20
 106: 2a 2f        mov r18, r26
 108: 20 93 02 01 sts 0x0102, r18 ; 0x800102 <__data_end>
 10c: 20 91 24 00 lds r18, 0x0024 ; 0x800024 <_stack_top+0x7ff725>
 110: 20 62        ori r18, 0x20 ; 32
 112: 20 93 24 00 sts 0x0024, r18 ; 0x800024 <_stack_top+0x7ff725>
 116: 20 91 25 00 lds r18, 0x0025 ; 0x800025 <_stack_top+0x7ff726>
 11a: 20 62        ori r18, 0x20 ; 32
 11c: 20 93 25 00 sts 0x0025, r18 ; 0x800025 <_stack_top+0x7ff726>
 120: 21 2d        mov r18, r1
 122: 20 93 46 00 sts 0x0046, r18 ; 0x800046 <_stack_top+0x7ff747>
 126: 21 2d        mov r18, r1
 128: 20 93 44 00 sts 0x0044, r18 ; 0x800044 <_stack_top+0x7ff745>
 12c: a5 e0        ldi r26, 0x05 ; 5
 12e: 2a 2f        mov r18, r26
 130: 20 93 45 00 sts 0x0045, r18 ; 0x800045 <_stack_top+0x7ff746>
 134: a1 e0        ldi r26, 0x01 ; 1
 136: 2a 2f        mov r18, r26
 138: 20 93 6e 00 sts 0x006E, r18 ; 0x80006e <_stack_top+0x7ff76f>
 13c: 78 94        sei
 13e: 00 c0        rjmp .+0      ; 0x140 <PASCALMAIN+0x40>
 140: ff cf        rjmp .-2      ; 0x140 <PASCALMAIN+0x40>
 142: 0e 94 a7 00 call 0x14e ; 0x14e <FPC_DO_EXIT>

00000146 <FPC_FINALIZE_FUNC_TABLE>:
 146: 08 95        ret

00000148 <SYSTEM_ss_INTERNALEXIT>:
 148: 0e 94 a3 00 call 0x146 ; 0x146 <FPC_FINALIZE_FUNC_TABLE>
 14c: 08 95        ret

0000014e <FPC_DO_EXIT>:
 14e: 0e 94 a4 00 call 0x148 ; 0x148 <SYSTEM_ss_INTERNALEXIT>
 152: 0e 94 ac 00 call 0x158 ; 0x158 <SYSTEM_ss_SYSTEM_EXIT>
 156: 08 95        ret

00000158 <SYSTEM_ss_SYSTEM_EXIT>:
 158: 0c 94 ae 00 jmp 0x15c ; 0x15c <ATMEGA328P_ss__FPC_HALTPROC>

0000015c <ATMEGA328P_ss__FPC_HALTPROC>:
 15c: f8 94        cli
 15e: ff cf        rjmp .-2      ; 0x15e <ATMEGA328P_ss__FPC_HALTPROC+0x2>

00000160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>:
 160: ff cf        rjmp .-2      ; 0x160 <ATMEGA328P_ss_DEFAULT_IRQ_HANDLER>

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: AVRPascal – free code editor for FPC for AVR
« Reply #20 on: October 24, 2024, 11:53:31 am »
Code: [Select]
000000ea <PsBLINK_ss_INIT>:
  ea: 20 91 24 00 lds r18, 0x0024 ; 0x800024 <_stack_top+0x7ff725>
  ee: 20 62        ori r18, 0x20 ; 32
  f0: 20 93 24 00 sts 0x0024, r18 ; 0x800024 <_stack_top+0x7ff725>

These instructions should be optimized into sbi 4,5. Seems like the compiler is not getting the optimization parameter?

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #21 on: October 24, 2024, 12:03:08 pm »
Code: [Select]
000000ea <PsBLINK_ss_INIT>:
  ea: 20 91 24 00 lds r18, 0x0024 ; 0x800024 <_stack_top+0x7ff725>
  ee: 20 62        ori r18, 0x20 ; 32
  f0: 20 93 24 00 sts 0x0024, r18 ; 0x800024 <_stack_top+0x7ff725>

These instructions should be optimized into sbi 4,5. Seems like the compiler is not getting the optimization parameter?


YES. Thank you :)

Code: [Select]
Free Pascal Compiler version 3.3.1 [2024/10/23] for avr
Copyright (c) 1993-2024 by Florian Klaempfl and others
Target OS: Embedded
Compiling C:\Programs\avr\avrpascal\examples\ccrause_blink.pas
Assembling blink
Linking C:\Programs\avr\avrpascal\examples\ccrause_blink
73 lines compiled, 0.5 sec, 264 bytes code, 3 bytes data

I will take a look at the system.pp compilation parameters, maybe some are not needed. Moreover I think I know what changes will be in the new version of AVRPascal :)
« Last Edit: October 24, 2024, 12:17:38 pm by ackarwow »

Dzandaa

  • Sr. Member
  • ****
  • Posts: 393
  • From C# to Lazarus
Re: AVRPascal – free code editor for FPC for AVR
« Reply #22 on: October 24, 2024, 03:40:50 pm »
Hi,

@ackarwow:

Great job!!!

Indeed, the code produced is larger than the one created by the Arduino IDE.

I tried the Blink program on an arduino Uno and it works.

I also tested on an Arduino Nano which is programmed correctly with the Arduino IDE, but not with AVRPascal because it needs the "old" bootloader.

Any solution?

Thank you.

B->
Regards,
Dzandaa

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #23 on: October 24, 2024, 05:21:14 pm »
Indeed, the code produced is larger than the one created by the Arduino IDE.
I tried the Blink program on an arduino Uno and it works.
I also tested on an Arduino Nano which is programmed correctly with the Arduino IDE, but not with AVRPascal because it needs the "old" bootloader.
Any solution?
Thank you for your comment  :)  I tested TestBlinkWithoutDelay.pas by Henk Heemstra and my TestBlink.pas on my Arduino Nano and it works... Yes, possibly it is due of bootloader.
As for the bootloader - at the moment I do not have solution. I have a lot of work to do with the new version of AVRPas (new compiler, changes in compilation parameters, changes in installers), but I hope that the code for Arduino will be smaller thanks to this.

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: AVRPascal – free code editor for FPC for AVR
« Reply #24 on: October 24, 2024, 08:01:32 pm »
I also tested on an Arduino Nano which is programmed correctly with the Arduino IDE, but not with AVRPascal because it needs the "old" bootloader.
Any solution?
...
Yes, possibly it is due of bootloader.
As for the bootloader - at the moment I do not have solution. I have a lot of work to do with the new version of AVRPas (new compiler, changes in compilation parameters, changes in installers), but I hope that the code for Arduino will be smaller thanks to this.
Obviously installing Optiboot should be a default option since it is widely used and quite compact.  There is also avrpasboot which is a concept serial bootloader.  Not quite as compact as Optiboot yet, but with a bit of effort it can be improved.  And it is written in Pascal!

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #25 on: October 27, 2024, 06:35:37 pm »
New AVRPascal 2.7 released. Here as usual http://akarwowski.pl/index.php?page=electronics&lang=en . Changes:
New compiler FPC 3.3.1. (commit 2262d2050defed7a5df8aa6c70ad696603335d3d)
Bug fixes:
- reduced size of binary output files; thanks to @mizar, @Dzandaa and especially @ccrause for help in finding and solving the problem!
New features:
- added source code formatter based on DelForEx (see ReadMe.txt); two code formatting schemes: "Delphi" and "Turbo Pascal" defined in the Options window;
  function called by keyboard shortcut Ctrl+D for active editor tab (thanks to Henk Heemstra for the suggestion to add a code formatter to the program).
« Last Edit: October 31, 2024, 07:21:34 am by ackarwow »

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #26 on: November 05, 2024, 07:24:16 am »
I have updated the PDF manual with the latest changes to AVRPascal. Since there are no comments, I assume the new features work perfectly ;)

VisualLab

  • Hero Member
  • *****
  • Posts: 575
Re: AVRPascal – free code editor for FPC for AVR
« Reply #27 on: November 06, 2024, 01:14:40 am »
I have conducted several experiments with AVRPascal, in two sessions. The first session took place on 07-10-2024, and the second one today (i.e. 06-11-2024). During the first session I used AVRPascal version 2.5, but today I updated AVRPascal and used version 2.7. For the experiments I used:
  • hardware: Arduino Uno R3, Waveshare clone (https://www.waveshare.com/uno-plus.htm),
  • operating system: Windows 10 64-bit,
  • software 1: AVRPascal - 2.5 (session I), 2.7 (session II),
  • software 2: Arduino IDE 2.3.3.
The Arduino board is powered by a USB cable. It is visible in Windows on the virtual COM5 port. It is recognized by AVRPascal as Arduino Nano. The probable cause is that it uses the FT232RL chip for communication (VID assigned to FTDI, PID assigned to the mentioned IC).

I performed the tests on 2 simple programs with a blinking LED:
  • TestBlink.pas,
  • TestDigital.pas.
Compilation runs quickly and without problems. In the AVRPascal program options, on the Compiler tab, I selected Arduino Uno as the device type every time. During upload, I set:
  • Interface: Arduino,
  • Port: COM5,
  • Device: ATmega328P,
  • option: Upload Flash memory.
After confirming the upload (OK button in the Upload dialog), AVRPascal reports subsequent (unsuccessful) attempts to communicate with the board:

Quote
„avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 2 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 3 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 4 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 5 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 6 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 7 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 8 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 9 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 10 of 10: not in sync: resp=0x00
avrdude error: unable to open programmer arduino on port com5

avrdude done.  Thank you.”

Attempting to program the board fails. I decided to check if the Arduino IDE would also have trouble programming the microcontroller. The Arduino board had been used many times before with the Arduino IDE, both in the 1.8 series and the newer 2.0 series. To be sure that the hardware was not the cause of the programming failure, I did not disconnect the USB cable (or make any hardware changes).

I closed the AVRPascal program. I launched the Arduino IDE program and checked if it reads the board information. I received the information: VID: 0x0403, PID: 0x6001 (the same as reported by AVRPascal). I loaded a similar (equivalent) code in C++, i.e. LED blinking. Compilation is fast and without problems. Programming is also fast and efficient, and the microcontroller is programmed the first time. The program uploaded to the microcontroller works as expected.

Both IDEs use the program avrdude to write the input to the microcontroller. AVR Pascal 2.7 uses avrdude in version 7.2, while Arduino IDE 2.3.3 uses avrdude in version 6.3.

So: what causes problems with uploading the batch to the Arduino microcontroller using AVRPascal?

ackarwow

  • Jr. Member
  • **
  • Posts: 82
    • Andrzej Karwowski's Homepage
Re: AVRPascal – free code editor for FPC for AVR
« Reply #28 on: November 06, 2024, 07:18:30 am »
(...)
So: what causes problems with uploading the batch to the Arduino microcontroller using AVRPascal?

Thank you for your comment and detailed description of this case. I will check it in th evening. Did you try use your Arduino Uno clone with unchecked option "Notify of connection or disconnection of supported device" (and restart AVRPascal)?

Dzandaa

  • Sr. Member
  • ****
  • Posts: 393
  • From C# to Lazarus
Re: AVRPascal – free code editor for FPC for AVR
« Reply #29 on: November 06, 2024, 04:47:47 pm »
Hi,

@ackarwow:

In hardwareserial.pas,
The procedure:
Serial.write(buf, len);
could be useful.

for example to send a structure and its size.

I use it with Arduino IDE to send commands to a linear stepper controlled rail.

in the editor, the "TAB" key has a strange behavior.

it would be nice to have the possibility to indent a block with "TAB" and "SHIFT TAB"

B->
Regards,
Dzandaa

 

TinyPortal © 2005-2018