Hi for all!
I make the Avrusbboot into my circuit with a ATmega128, but, I have some doubts.
I need a solution like this http://avrusb.wikidot.com/project:crypto-boot
That peoples can updating they hardwares but can´t took the unprotected .hex file.
I want that from the first firmware are protected.
Atmel´s AES use only serial bootloader.
Crypto from Oleg work with usb like your avrusbboot.
My problem is to port Oleg code to m128 and winavr. Because have some erros and don´t sucess with it.
Somebody know or have some solution (like Oleg´s code) for use AVRusb boot solution with AES security and m128 ?
Regards!
DrTk
AVR-USB: Crypto Boot with m128
-
- Rank 1
- Posts: 25
- Joined: Wed Jul 23, 2008 5:31 am
- Location: JAPAN
Re: AVR-USB: Crypto Boot with m128
I make an example "USBaspLoader.2008-02-05\firmware".
I do the name of the file to intend for precisely.
Wrong "XXcfg.h" that it is next, right "bootloaderconfig.h."
I do the name of the file to intend for precisely.
Wrong "XXcfg.h" that it is next, right "bootloaderconfig.h."
Last edited by apollononnno on Sun Aug 10, 2008 5:30 am, edited 1 time in total.
hi kyoji,
I make some modifications..but when I tried to comile the code using winavr I got errors from compile, change some things but don´t solve the error about this line
extern void puts_P_nr(char __flash *s );
the error are as this:
error: expected ';', ',' or ')' before '*' token
I don´t know how to solve this. Then I will try today download IAR from web and compile it with my needs(crypto working under m128). But my all project are in Winavr and I like work with gcc, I never work with another IDE like IAR or CODEVISION... If I get sucess I post here the solution, but if somebody have a crypto firmware compiled with winavr (with changes to compile correctly) and can share it it´s great!
Regards!
DrTk
I make some modifications..but when I tried to comile the code using winavr I got errors from compile, change some things but don´t solve the error about this line
extern void puts_P_nr(char __flash *s );
the error are as this:
error: expected ';', ',' or ')' before '*' token
I don´t know how to solve this. Then I will try today download IAR from web and compile it with my needs(crypto working under m128). But my all project are in Winavr and I like work with gcc, I never work with another IDE like IAR or CODEVISION... If I get sucess I post here the solution, but if somebody have a crypto firmware compiled with winavr (with changes to compile correctly) and can share it it´s great!
Regards!
DrTk
-
- Rank 1
- Posts: 25
- Joined: Wed Jul 23, 2008 5:31 am
- Location: JAPAN
I make an example "USBaspLoader.2008-02-05\firmware".
I do the name of the file to intend for precisely.
Wrong "XXcfg.h" that it is next, right "bootloaderconfig.h."
/* ---bootloaderconfig.h------- Hardware Config ---------------------------- */
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* ---Makefile----------------------------------- */
F_CPU = 12000000
DEVICE = atmega128
As a result of having been provided.
C:\avrs\USBaspLoader.2008-02-05\USBaspLoader.2008-02-05\128firmware>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 did it in the same way and tried "168p".
As a result of having been provided.
/* ---bootloaderconfig.h------ Hardware Config ---------------------------- */
#define USB_CFG_IOPORTNAME C
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* ---Makefile----------------------------------- */
F_CPU = 16000000
DEVICE = atmega168
C:\avrs\USBaspLoader.2008-02-05\USBaspLoader.2008-02-05\168firmware>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 compiled "AVRminiProg" with mega128.
I do not really confirm the movement.
/* ---app_cfg.h------ function Config ---------------------------- */
// Include this if use AVRminiProg_Full
#include "app_cfg_Full.h"
/* ---app_cfg_Full.h- Hardware Config ---------------------------- */
/*************************** AVRUSB *****************************/
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
C:\avrs\64fullAVRminiProg>make
make -C default all
make[1]: Entering directory `C:/avrs/64fullAVRminiProg/default'
avr-objcopy -O ihex -R .eeprom AVRminiProg.elf AVRminiProg.hex
AVR Memory Usage
----------------
Device: atmega64
Program: 14610 bytes (22.3% Full)
(.text + .data + .bootloader)
Data: 501 bytes (12.2% Full)
(.data + .bss + .noinit)
make[1]: Leaving directory `C:/avrs/64fullAVRminiProg/default'
http://2.suk2.tok2.com/user/nonnno-prot ... 8-04-0.JPG
I do the name of the file to intend for precisely.
Wrong "XXcfg.h" that it is next, right "bootloaderconfig.h."
/* ---bootloaderconfig.h------- Hardware Config ---------------------------- */
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* ---Makefile----------------------------------- */
F_CPU = 12000000
DEVICE = atmega128
As a result of having been provided.
C:\avrs\USBaspLoader.2008-02-05\USBaspLoader.2008-02-05\128firmware>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 did it in the same way and tried "168p".
As a result of having been provided.
/* ---bootloaderconfig.h------ Hardware Config ---------------------------- */
#define USB_CFG_IOPORTNAME C
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
/* ---Makefile----------------------------------- */
F_CPU = 16000000
DEVICE = atmega168
C:\avrs\USBaspLoader.2008-02-05\USBaspLoader.2008-02-05\168firmware>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 compiled "AVRminiProg" with mega128.
I do not really confirm the movement.
/* ---app_cfg.h------ function Config ---------------------------- */
// Include this if use AVRminiProg_Full
#include "app_cfg_Full.h"
/* ---app_cfg_Full.h- Hardware Config ---------------------------- */
/*************************** AVRUSB *****************************/
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 0
C:\avrs\64fullAVRminiProg>make
make -C default all
make[1]: Entering directory `C:/avrs/64fullAVRminiProg/default'
avr-objcopy -O ihex -R .eeprom AVRminiProg.elf AVRminiProg.hex
AVR Memory Usage
----------------
Device: atmega64
Program: 14610 bytes (22.3% Full)
(.text + .data + .bootloader)
Data: 501 bytes (12.2% Full)
(.data + .bss + .noinit)
make[1]: Leaving directory `C:/avrs/64fullAVRminiProg/default'
http://2.suk2.tok2.com/user/nonnno-prot ... 8-04-0.JPG
But do you use Oleg (Crypto Boot) code?
My first important thing are the AES crypto. Understand?
I make download of IAR AVR 5.11 and compile give me error:
Error[e16]: Segment CODE (size: 0x1046 align: 0x1) is too long for segment definition. At least 0x6c more bytes needed. The problem occurred while processing the segment placement
command "-Z(CODE)CODE=(_FLASH_BASE)-_FLASH_END", where at the moment of placement the available memory ranges were
"CODE:1e000-1e003,CODE:1e07f-1effb,CODE:1effe-1efff,CODE:1f006-1ffdf,CODE:1fffa-1ffff"
Reserved ranges relevant to this placement:
CODE:1e000-1e003 CODE
CODE:1e004-1e070 FAR_F
CODE:1e071-1e07e INITTAB
CODE:1e07f-1effb CODE
CODE:1effc-1effd APP_VERSION
CODE:1effe-1efff CODE
CODE:1f000-1f005 INTVEC
CODE:1f006-1ffdf CODE
CODE:1ffe0-1fff9 SERIAL_NUMBER
CODE:1fffa-1ffff CODE
Total number of errors: 1
Total number of warnings: 1
please if somebody know how to solve it, please post a reply. Regards
DrTk
My first important thing are the AES crypto. Understand?
I make download of IAR AVR 5.11 and compile give me error:
Error[e16]: Segment CODE (size: 0x1046 align: 0x1) is too long for segment definition. At least 0x6c more bytes needed. The problem occurred while processing the segment placement
command "-Z(CODE)CODE=(_FLASH_BASE)-_FLASH_END", where at the moment of placement the available memory ranges were
"CODE:1e000-1e003,CODE:1e07f-1effb,CODE:1effe-1efff,CODE:1f006-1ffdf,CODE:1fffa-1ffff"
Reserved ranges relevant to this placement:
CODE:1e000-1e003 CODE
CODE:1e004-1e070 FAR_F
CODE:1e071-1e07e INITTAB
CODE:1e07f-1effb CODE
CODE:1effc-1effd APP_VERSION
CODE:1effe-1efff CODE
CODE:1f000-1f005 INTVEC
CODE:1f006-1ffdf CODE
CODE:1ffe0-1fff9 SERIAL_NUMBER
CODE:1fffa-1ffff CODE
Total number of errors: 1
Total number of warnings: 1
Code: Select all
In Options/Linker/#define I use:
BOOT_SIZE=1000
FLASH_SIZE=20000
IVT_SIZE=8C
RAM_SIZE=1000
RAM_BASE=100
APP_SRAM_USAGE=41E
RSTACK=100
CSTACK=40
in bootldr.xcl I use:
-D_INTVEC_SIZE=4 /* Vector table (only the reset "vector" is needed) */
-D_FLASH_BASE=1E000 /* START OF BOOTLOADER BLOCK IN FLASH MEMORY */
-D_FLASH_TEND=FF /* End of tiny flash memory */
-D_FLASH_NEND=FFFF /* End of near flash memory */
-D_FLASH_END=1FFFF /* End of flash memory */
-D_SRAM_BASE=100 /* Start of ram memory */
-D_SRAM_TEND=100 /* End of tiny ram memory */
-D_SRAM_END=10FF /* End of ram memory */
-D_EEPROM_END=FFF /* End of eeprom memory */
-D_CSTACK_SIZE=100 /* 256 bytes for auto variables and saved registers. */
-D_RSTACK_SIZE=40 /* 64 bytes for return addresses, equivalent to 32 */
/* levels of calls, including interrupts. */
-D_HEAP_SIZE=100 /* 256 bytes of heap. */
-D_NEAR_HEAP_SIZE=100 /* 256 bytes of heap. */
-ca90
-w29
-Z(FARCODE)FAR_F=(_FLASH_BASE+_INTVEC_SIZE)-_FLASH_END
-Z(CODE)INITTAB=(_FLASH_BASE+_INTVEC_SIZE)-_FLASH_END
-Z(CODE)APP_VERSION=(FLASH_SIZE-BOOT_SIZE-4)-(FLASH_SIZE-BOOT_SIZE-3)
-Z(CODE)INTVEC=_FLASH_BASE-(_FLASH_BASE+_INTVEC_SIZE-1)
-Z(CODE)SERIAL_NUMBER=(FLASH_SIZE-20)-(FLASH_SIZE-7)
-Z(CODE)CODE=(_FLASH_BASE)-_FLASH_END
-Z(CODE)NEAR_F=_INTVEC_SIZE-_FLASH_NEND
-Z(CODE)NEAR_ID=_INTVEC_SIZE-_FLASH_NEND
-Z(DATA)TINY_Z=_SRAM_BASE-_SRAM_TEND
-Z(DATA)NEAR_C,NEAR_I=_SRAM_BASE-_SRAM_END
-Z(DATA)NEAR_Z=_SRAM_BASE-_SRAM_END
please if somebody know how to solve it, please post a reply. Regards
DrTk