About the boot loader
About the boot loader
Hi all
I compiled the following with avrstudio4.
The target is "Internal RC12MHz" and "D+-PC0,D-PC1" as for "atmega168p" It
aims at USB connection and "bootloader" of (PCint8 PCICR-PCIE1(1) PCIFR-
PCIF1(1) PCMSK1-PCINT8(0) 5 0x0008 PCINT1).
usbdrv.h
#ifndef USB_INTR_ENABLE /* allow user to override our default */
# if defined GIMSK
# define USB_INTR_ENABLE GIMSK//?
# elif defined EIMSK
# define USB_INTR_ENABLE EIMSK//PCMSK1-PCINT8(0)
# else
# define USB_INTR_ENABLE GICR//?
# endif
#endif
#ifndef USB_INTR_ENABLE_BIT /* allow user to override our default */
# define USB_INTR_ENABLE_BIT INT0//PCINT8
# endif
usbdrvasm.S
makefile
F_CPU = 12000000
DEVICE = atmega168
BOOTLOADER_ADDRESS = 3800
FUSEOPT = $(FUSEOPT_168)
LOCKOPT = -U lock:w:0x2f:m
usbconfig-prototype.h & bootloaderconfig.h
#define USB_CFG_IOPORTNAME C
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* #define USB_CFG_PULLUP_IOPORTNAME C */
/* #define USB_CFG_PULLUP_BIT 1 */
USBaspLoader.2008-02-05
EasyLogger.2008-02-28
However, it returns the following mistakes.
gcc plug-in: Error: Object file not found on expected location C:\avrs\EasyLogger. What should 2008-02-28\EasyLogger.2008-02-28\cfirmware\ceasyogger.elf I note?
Do you concretely make it like any though I want to build in "osccal.c"?
kyoji
I compiled the following with avrstudio4.
The target is "Internal RC12MHz" and "D+-PC0,D-PC1" as for "atmega168p" It
aims at USB connection and "bootloader" of (PCint8 PCICR-PCIE1(1) PCIFR-
PCIF1(1) PCMSK1-PCINT8(0) 5 0x0008 PCINT1).
usbdrv.h
#ifndef USB_INTR_ENABLE /* allow user to override our default */
# if defined GIMSK
# define USB_INTR_ENABLE GIMSK//?
# elif defined EIMSK
# define USB_INTR_ENABLE EIMSK//PCMSK1-PCINT8(0)
# else
# define USB_INTR_ENABLE GICR//?
# endif
#endif
#ifndef USB_INTR_ENABLE_BIT /* allow user to override our default */
# define USB_INTR_ENABLE_BIT INT0//PCINT8
# endif
usbdrvasm.S
makefile
F_CPU = 12000000
DEVICE = atmega168
BOOTLOADER_ADDRESS = 3800
FUSEOPT = $(FUSEOPT_168)
LOCKOPT = -U lock:w:0x2f:m
usbconfig-prototype.h & bootloaderconfig.h
#define USB_CFG_IOPORTNAME C
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* #define USB_CFG_PULLUP_IOPORTNAME C */
/* #define USB_CFG_PULLUP_BIT 1 */
USBaspLoader.2008-02-05
EasyLogger.2008-02-28
However, it returns the following mistakes.
gcc plug-in: Error: Object file not found on expected location C:\avrs\EasyLogger. What should 2008-02-28\EasyLogger.2008-02-28\cfirmware\ceasyogger.elf I note?
Do you concretely make it like any though I want to build in "osccal.c"?
kyoji
I never tried gcc with avrstudio, so I can't comment on that. If you use WinAVR, you can use our standard Makefiles.
Adding osccal.c may become tight due to the 2kB restriction for boot loaders.
To use the Pin Change Interrupt, you need to change the last section of usbconfig.h:
I have not done this myself, but I remember that people here in the forum did. Please search the archives.
Adding osccal.c may become tight due to the 2kB restriction for boot loaders.
To use the Pin Change Interrupt, you need to change the last section of usbconfig.h:
Code: Select all
/* ----------------------- Optional MCU Description ------------------------ */
/* The following configurations have working defaults in usbdrv.h. You
* usually don't need to set them explicitly. Only if you want to run
* the driver on a device which is not yet supported or with a compiler
* which is not fully supported (such as IAR C) or if you use a differnt
* interrupt than INT0, you may have to define some of these.
*/
/* #define USB_INTR_CFG MCUCR */
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
/* #define USB_INTR_CFG_CLR 0 */
/* #define USB_INTR_ENABLE GIMSK */
/* #define USB_INTR_ENABLE_BIT INT0 */
/* #define USB_INTR_PENDING GIFR */
/* #define USB_INTR_PENDING_BIT INTF0 */
/* #define USB_INTR_VECTOR SIG_INTERRUPT0 */
I have not done this myself, but I remember that people here in the forum did. Please search the archives.
About the method
Thank you for Mr. christian.
The method of settlement was obtained.
It doesn't make an error of it by safely passing if "Ceasyogger.elf (The content is empty)" is put in the corresponding holder, and "ceasyogger.elf" disappears.
Does it operate only one time at the first start or sometimes operate
and correct "OSCCAL"?
I copied \cfirmware\libs-device\osccal.h and \cfirmware\libs-device\
osccal.c onto the corresponding holder.
To build in "OSCCAL", do you make it like any?
I look for the archive further.
kyoji
The method of settlement was obtained.
It doesn't make an error of it by safely passing if "Ceasyogger.elf (The content is empty)" is put in the corresponding holder, and "ceasyogger.elf" disappears.
Does it operate only one time at the first start or sometimes operate
and correct "OSCCAL"?
I copied \cfirmware\libs-device\osccal.h and \cfirmware\libs-device\
osccal.c onto the corresponding holder.
To build in "OSCCAL", do you make it like any?
I look for the archive further.
kyoji
The later change
I made the first aim "mega168p, 12MHz, D+_PC0, D-_PC1, the boot loader" which I used "OSCCAL" for.
I compiled original "EasyLogger.2008-02-28" in avrstudio4 for the study and I compiled it replacing with "mega168p-12MHz" to be next and succeeded.
When add "OSCCAL" afterwards; "main.c:" 250: error: static declaration of 'calibrateOscillator' follows non-static declaration "libs-device/osccal.h:" 44:00 error: I became the error of previous declaration of 'calibrateOscillator' was here.
I stopped it once here and I compiled original "USBaspLoader.2008-02-05" "mega168p-12MHz" and succeeded.
It is changed "D+_PC0, D-_PC1" to be next
#define USB_CFG_IOPORTNAME C
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* #define USB_CFG_PULLUP_IOPORTNAME C */
/* #define USB_CFG_PULLUP_BIT One */
I changed を of it and succeeded in compiling it.
When add "osccal.c" just before "int main(void)" in "main.c" afterwards; "main.c:" (.text+0x524): I become the error of undefined reference to `usbMeasureFrameLength'.
kyoji
I compiled original "EasyLogger.2008-02-28" in avrstudio4 for the study and I compiled it replacing with "mega168p-12MHz" to be next and succeeded.
When add "OSCCAL" afterwards; "main.c:" 250: error: static declaration of 'calibrateOscillator' follows non-static declaration "libs-device/osccal.h:" 44:00 error: I became the error of previous declaration of 'calibrateOscillator' was here.
I stopped it once here and I compiled original "USBaspLoader.2008-02-05" "mega168p-12MHz" and succeeded.
It is changed "D+_PC0, D-_PC1" to be next
#define USB_CFG_IOPORTNAME C
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* #define USB_CFG_PULLUP_IOPORTNAME C */
/* #define USB_CFG_PULLUP_BIT One */
I changed を of it and succeeded in compiling it.
When add "osccal.c" just before "int main(void)" in "main.c" afterwards; "main.c:" (.text+0x524): I become the error of undefined reference to `usbMeasureFrameLength'.
kyoji
About the direction of the change
I examined it about an interrupt.
I start an action by the upward movement of the "INT0" signal by the original.
I catch even the change of either direction in "PCINT8" which I hope for.
How do you do the handling of this case?
kyoji
/* #define USB_INTR_CFG MCUCR / IVSEL? IVCE?*/
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) / EICRA?INT0↑ */
/* #define USB_INTR_CFG_CLR 0 */
/* #define USB_INTR_ENABLE GIMSK / PCMSK1*/
/* #define USB_INTR_ENABLE_BIT INT0 / PCINT8*/
/* #define USB_INTR_PENDING GIFR / PCIFR*/
/* #define USB_INTR_PENDING_BIT INTF0 / PCIF1*/
I start an action by the upward movement of the "INT0" signal by the original.
I catch even the change of either direction in "PCINT8" which I hope for.
How do you do the handling of this case?
kyoji
/* #define USB_INTR_CFG MCUCR / IVSEL? IVCE?*/
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) / EICRA?INT0↑ */
/* #define USB_INTR_CFG_CLR 0 */
/* #define USB_INTR_ENABLE GIMSK / PCMSK1*/
/* #define USB_INTR_ENABLE_BIT INT0 / PCINT8*/
/* #define USB_INTR_PENDING GIFR / PCIFR*/
/* #define USB_INTR_PENDING_BIT INTF0 / PCIF1*/
I'm not sure I understand what you are asking...
Looking at the code: You still have those defines commented out. But I see that you have already found the appropriate values for the defines. I have not checked them, but you obviously understood the concept.
Regarding interrupt edge sensitivity: The driver should work with any edge (rising / falling / both). Just try it.
Looking at the code: You still have those defines commented out. But I see that you have already found the appropriate values for the defines. I have not checked them, but you obviously understood the concept.
Regarding interrupt edge sensitivity: The driver should work with any edge (rising / falling / both). Just try it.
Is the result good in this?
Thank you for an answer.
I have made a mistake in the name letter of this forum.
In addition, the ID name has been wrong, too.
Is there the method to redo being right?
I did not find the item which fell under "1".
I validated "2" and got a result of compiling it.
However, I was not "three" negative results in that, but watched a slightly bad part.
Do not I need to pay attention to this item?
1
/* #define USB_INTR_CFG MCUCR / IVSEL? IVCE? */
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) / EICRA?INT0 */
2
#define USB_INTR_CFG_CLR 0
#define USB_INTR_ENABLE PCMSK1
#define USB_INTR_ENABLE_BIT PCINT8
#define USB_INTR_PENDING PCIFR
#define USB_INTR_PENDING_BIT PCIF1
3
usbdrv/usbdrv.h:198: warning: 'usbFunctionDescriptor' used but never defined
4
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
avr-size main.hex
text data bss dec hex filename
0 2520 0 2520 9d8 main.hex
Build succeeded with 1 Warnings...
I intend I add "OSCCAL", and to try RC12MHz.
I do not know the position that is necessary for the addition.
I have made a mistake in the name letter of this forum.
In addition, the ID name has been wrong, too.
Is there the method to redo being right?
I did not find the item which fell under "1".
I validated "2" and got a result of compiling it.
However, I was not "three" negative results in that, but watched a slightly bad part.
Do not I need to pay attention to this item?
1
/* #define USB_INTR_CFG MCUCR / IVSEL? IVCE? */
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) / EICRA?INT0 */
2
#define USB_INTR_CFG_CLR 0
#define USB_INTR_ENABLE PCMSK1
#define USB_INTR_ENABLE_BIT PCINT8
#define USB_INTR_PENDING PCIFR
#define USB_INTR_PENDING_BIT PCIF1
3
usbdrv/usbdrv.h:198: warning: 'usbFunctionDescriptor' used but never defined
4
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
avr-size main.hex
text data bss dec hex filename
0 2520 0 2520 9d8 main.hex
Build succeeded with 1 Warnings...
I intend I add "OSCCAL", and to try RC12MHz.
I do not know the position that is necessary for the addition.
For the Pin Change thing, see the end of this thread:
http://forums.obdev.at/viewtopic.php?t=1067&start=15
This was on the tiny45, but it's still an example for using the pin change interrupt.
A different issue: The osccal routine is too big for a 2 k boot loader. Your code size is ~ 2.5 k, too much for the boot section. You'll probably find a different way to calibrate the oscillator or otherwise reduce the code size.
http://forums.obdev.at/viewtopic.php?t=1067&start=15
This was on the tiny45, but it's still an example for using the pin change interrupt.
A different issue: The osccal routine is too big for a 2 k boot loader. Your code size is ~ 2.5 k, too much for the boot section. You'll probably find a different way to calibrate the oscillator or otherwise reduce the code size.
-
- Rank 1
- Posts: 25
- Joined: Wed Jul 23, 2008 5:31 am
- Location: JAPAN
About size.
You compiled it.
It is the firm ware which I download it, and unfolded.
Going astray "size mega168_12mhz.hex"
text data bss dec hex filename
0 2028 0 2028 7ec mega168_12mhz.hex
It is displayed.
I downloaded it.
I did "make" of "USBaspLoader.2008-02-05" in "WinAVR-20080512" and compiled it.
"main.hex" is displayed as follows.
"size main.hex"
text data bss dec hex filename
0 2392 0 2392 958 main.hex.
As for it, memory consumption changes.
Did you compile it in "WinAVR", which version?
It is the firm ware which I download it, and unfolded.
Going astray "size mega168_12mhz.hex"
text data bss dec hex filename
0 2028 0 2028 7ec mega168_12mhz.hex
It is displayed.
I downloaded it.
I did "make" of "USBaspLoader.2008-02-05" in "WinAVR-20080512" and compiled it.
"main.hex" is displayed as follows.
"size main.hex"
text data bss dec hex filename
0 2392 0 2392 958 main.hex.
As for it, memory consumption changes.
Did you compile it in "WinAVR", which version?
-
- Rank 1
- Posts: 25
- Joined: Wed Jul 23, 2008 5:31 am
- Location: JAPAN
Is there any hint?
C:\avrs\usbtest\USBaspLoader.2008-02-05\USBaspLoader.2008-02-05\firmware>avr-gcc
-v
Reading specs from C:/WinAVR-20060421/lib/gcc/avr/3.4.6/specs
Configured with: ../gcc-3.4.6/configure --prefix=/c/WinAVR --target=avr --enable
-languages=c,c++ --with-dwarf2 --enable-win32-registry=WinAVR --disable-nls
Thread model: single
gcc version 3.4.6
C:\avrs\usbtest\USBaspLoader.2008-02-05\USBaspLoader.2008-02-05\firmware>make
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
avr-size main.hex
text data bss dec hex filename
0 2392 0 2392 958 main.hex
I tried the above.
However, I did not become "2028".
-v
Reading specs from C:/WinAVR-20060421/lib/gcc/avr/3.4.6/specs
Configured with: ../gcc-3.4.6/configure --prefix=/c/WinAVR --target=avr --enable
-languages=c,c++ --with-dwarf2 --enable-win32-registry=WinAVR --disable-nls
Thread model: single
gcc version 3.4.6
C:\avrs\usbtest\USBaspLoader.2008-02-05\USBaspLoader.2008-02-05\firmware>make
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
avr-size main.hex
text data bss dec hex filename
0 2392 0 2392 958 main.hex
I tried the above.
However, I did not become "2028".
-
- Rank 1
- Posts: 25
- Joined: Wed Jul 23, 2008 5:31 am
- Location: JAPAN
Some programs are breaks. (I am tired and am absent)
I am assigned to a different result being given and do not doubt it.
My age has exceeded 60, but my technology and knowledge are still unripe.
Perhaps I think with the result that I be accompanied and forget some kind of options and compile. (I am unripe in optional contents).
Like you, I wish that I want to arrive at a satisfactory result early.
A story changed and went to Vienna by a sightseeing tour six years ago.
I asked an unknown person the place of "association of music friend" in Japanese.
The person taught it in English.
Association of music friend was near immediately, but was under construction.
I asked Grandfather of "the key shop" a key elsewhere and bought "a key" and "door metal fittings".
It was Japanese and German then that two people talked.
My age has exceeded 60, but my technology and knowledge are still unripe.
Perhaps I think with the result that I be accompanied and forget some kind of options and compile. (I am unripe in optional contents).
Like you, I wish that I want to arrive at a satisfactory result early.
A story changed and went to Vienna by a sightseeing tour six years ago.
I asked an unknown person the place of "association of music friend" in Japanese.
The person taught it in English.
Association of music friend was near immediately, but was under construction.
I asked Grandfather of "the key shop" a key elsewhere and bought "a key" and "door metal fittings".
It was Japanese and German then that two people talked.