I tried the bootloader of ATTINY13A as the pursuit of one of the potential of Tiny PIC Bootloader +.
Range of bootloader is 0x01A0_0x01FF same as PIC10F322.
Changes the host side,
Since the first Four words suffer the interrupt vector of ATTINY, rewrite only address 0x0000.
I do not rewrite the code of the address 0x019C_0x019F.
User-written code to jump to the source file.
ATTINY outputs separately EEPROM code and program code,
but, EEPROM code is writable if you change the format of the normal PIC16.
I attach bootloader source, sample program (console "0" output), assembler template,
or modify Tiny PIC Bootloader +.
My suggestion this time,
is one of the applications of the Tiny PIC Bootloader +.
And to implement a bootloader to ATTINY is, difficulty is accompanied unlike PIC.
I think bootloader compact and in good quality to ATTINY for this difficulty.
(AVR_loader compact even is 128 words.)
Interrupt vector is in place from next to the reset vector is 0x0000 ATTINY.
Only 1 byte is allowed to jump backward to flush memory.
There are two types of IJMP and RJMP the JUMP instruction ATTINY,
but the scope of RJMP is 1 byte instructionIt is not only up from 0x1FFF 0x0000.
Therefore, you can not be placed back on the bootloader in the chip to the mounted flush memory than ATTINY13.
If you try to solve this problem,
this raises a new issue "Where to place the IJMP" that big also,
unlike the design concept of the Tiny PIC Bootloader + process of two-stage jump is required you.
I believe that it should not include the option of ATTINY to Tiny PIC Bootloader +.
Best regards,
Dan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's good to hear that you've find a workaround to make ATTINY13 working with "Tiny (PIC) Bootlader+" !!!!!
But I've some questions and remarks:
Questions:
- is there a way to modify ".dw 0xcf9f" with something more portable like:
.dw CODE_FOR_RJMP+(MAX_MEM - BOOTLOADER_SIZE) ?
- when using your ATTINY13A bootloader firmware, do you need to make some changes in the application source code?
- in your "template_attiny13A.asm" there is "#define W_TBL". It seems it isn't used with "Tiny (PIC) Bootloader+", so what is its purpose?
Remarks:
- your "//**" in the PC source code is a very good idea!
- you should create new families for AVR. For example "#A" for tinyAVR, "#B" for megaAVR... So in the PC software it will be easier to test if it's AVR or PIC device (if "family start with '#'" then "it's AVR" else "it's PIC")
- beware when you try to load ".eep", you must verify if the device is a PIC or an AVR. You should also test if the file exists.
- I don't understand why you define "selectedPicInfos.eepromflag=10" and "selectedPicInfos.eepromflag=0" as it's never used.
I think I had other questions and remarks but I can't remember them :-p
Best regards,
Edorul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
rewrite 0x0000 ".DW CODE_FOR_RJMP+(CURRENT_POSITION - BOOTLOADER_SIZE)"
write 0x019c Same code and 0x000
write 0x019d "LDI zl,low(0x0001)"
write 0x019e "LDI zh,high(0x0001)"
write 0x019f "IJMP" ;jump to (z)
host has been rewritten if pic, but has not been rewritten in remodeling my host.
It specified in the template.
!!! Very good to be able to change the host as pic !!!
Q3
- in your "template_attiny13A.asm" there is "#define W_TBL".
It seems it isn't used with "Tiny (PIC) Bootloader+", so what is its purpose?
There is a reason it is to have defined in the template W_TBL.
For example, useful, for example, when you want to temporarily change the allocation of port TX, the RX.
bootloader since they are compiled together when you compile by defining W_TBL,
you can not use the bootloader, but the process of writing can be shortened.
Q4
- beware when you try to load ".eep", you must verify if the device is a PIC or an AVR.
You should also test if the file exists.
The host of my current, I will generate an error that there is no eep file even if there is no need to write EEPROM.
I am generating eep file to force wait at the Tenplate is currently.
What should I do to do not want to open the eep file when you do not need to write the eeprom?
Q5
- I don't understand why you define "selectedPicInfos.eepromflag=10" and "selectedPicInfos.eepromflag=0" as it's never used.
It is provided to distinguish write eep file writing and hex file this variable.
If not provided this variable, flash area will be written twice for some reason.
What you want of me,
1.Do not open eep file when "write EEPROM" is not selected.
2.hex file is written only flash area, EEPROM write only the eep file.
Please give me good advice.
Best regards,
Dan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've made some changes to your code (I've mainly added a "#A" family for tinyAVR and separate it from PIC "B" family). They are between "//$$" lines. I've added some questions for you between "???".
Please take a look at them and tell me if it works.
It's great you've created bootloader firmware for ATtiny2313 :-)
As ATtiny13 is without UART, and as ATtiny2313 has an UART, can all ATtiny devices be used with your bootloader firmwares?
About "Modifications_0.21":
- if I understood, "#define W_TBL" can't be used with "Tiny (PIC) Bootloader+"? Is it usefull to put "template_attinyxxxx.asm" files in the "Tiny (PIC) Bootloader+" archive?
- in "Form1.cs", I've moved
if (selectedPicInfos.family == "#A")
{
//!!1
int opecode;
int operand;
int j_address;
int jp_hh;
int jp_hl;
int jp_lh;
int jp_ll;
etc...
//!!1e
}
from "transfertHexToArray(string[] lines)" to "configureTransfert()" function. I hope it isn't a problem.
- can you verify in "Form1.cs" all the lines with "???" if they are OK, and then delete "???...???" to show it has been verified?
When you think tinyAVR bootloader is OK, I'll publish it with "Tiny (PIC) Bootloader+" :-)
if (selectedPicInfos.family == "#A")
{
//!!1
int opecode;
int operand;
int j_address;
int jp_hh;
int jp_hl;
int jp_lh;
int jp_ll;
etc...
//!!1e
}
from "transfertHexToArray(string[] lines)" to "configureTransfert()" function, I've left an error as "extendedAddress" variable was not declared in this function.
So I've added:
Q1
- if I understood, "#define W_TBL" can't be used with "Tiny (PIC) Bootloader+"? Is it usefull to put "template_attinyxxxx.asm" files in the "Tiny (PIC) Bootloader+" archive?
A1
I think that there is no need to include in the archive template of assembler.
Q2(in source)
const int familyAvrA_DefaultBootloaderSize = 200; //???I'm not sure???; // in bytes
A2
const int familyAvrA_DefaultBootloaderSize = 168;
Q3(in source)
const int familyAvrA_DefaultBlockSize = 32; //???I'm not sure???; // in bytes
A3
meny attiny chip has 16words, so I think 32 bytes is good (provisional)
ATtiny44A/84A=32words
Q4(in source)
// ???test for config data with tinyAVR, is it usefull??? --->
A4 I think this part is good-PIC limited.
Q5(in source)
// write block size 32 ???I'm not sure???
A5
Same Q3
Q6(in source)
// ???it's wrong, can you fix it??? --->
A6
Fixed
Q7(in source)
tempInfos.eepromMem *= 2; // ???I'm not sure if it's usefull for tinyAVR??? for "tinyAVR" family EEPROM addressing is in words and not bytes
A7
The live better defined as well as the TYPE-B is less change in the program.
Q8
When you think tinyAVR bootloader is OK, I'll publish it with "Tiny (PIC) Bootloader+" :-)
A8
Remaining Issues
1.With only HEX file, operation confirmation when the EEP file does not exist.
2.Checking the operation ATTINY8X,16X constraints RJMP is a problem.
Can be placed at the end of the flash memory the boot loader?
And it can be accessed in one instruction word here Really?
I purchased a ATTINY816A.
[My View]
1.ATTINY is easy to do is transplant the boot loader compared to PIC.
2.Type write page size and erase block size is different exists, it will be able to fit into 84 bytes.
3.There is a feature called bootloader support the ATMEGA, but for this, it is studying.
Thank you very much new host programs.
And reports the results to try.
Best regards,
Dan
Last edit: Dan 2013-07-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear Edorul. and All.
I tried the bootloader of ATTINY13A as the pursuit of one of the potential of Tiny PIC Bootloader +.
Range of bootloader is 0x01A0_0x01FF same as PIC10F322.
Changes the host side,
Since the first Four words suffer the interrupt vector of ATTINY, rewrite only address 0x0000.
I do not rewrite the code of the address 0x019C_0x019F.
User-written code to jump to the source file.
ATTINY outputs separately EEPROM code and program code,
but, EEPROM code is writable if you change the format of the normal PIC16.
I attach bootloader source, sample program (console "0" output), assembler template,
or modify Tiny PIC Bootloader +.
Best regards,
Dan
Last edit: Dan 2013-06-18
Dear Edorul. and All.
I changed the program on the host side.
If you specify a hex file,
this boot loader is the specifications that sequentially reads hex file, the eep file.
When writing to EEPROM, there is no need to join hex file, the eep file.
Best regards,
Dan
Hello Dan!
It's a good idea to expand "Tiny Pic Bootloader+" with AVR programmation. But, because of you, I'll have to change its name ;-)
For the moment I can't take a look at your modifications. I'll do it as soon as I can.
Best regards,
Edorul
Dear Edorul.
Thank you very much reply.
My suggestion this time,
is one of the applications of the Tiny PIC Bootloader +.
And to implement a bootloader to ATTINY is, difficulty is accompanied unlike PIC.
I think bootloader compact and in good quality to ATTINY for this difficulty.
(AVR_loader compact even is 128 words.)
Interrupt vector is in place from next to the reset vector is 0x0000 ATTINY.
Only 1 byte is allowed to jump backward to flush memory.
There are two types of IJMP and RJMP the JUMP instruction ATTINY,
but the scope of RJMP is 1 byte instructionIt is not only up from 0x1FFF 0x0000.
Therefore, you can not be placed back on the bootloader in the chip to the mounted flush memory than ATTINY13.
If you try to solve this problem,
this raises a new issue "Where to place the IJMP" that big also,
unlike the design concept of the Tiny PIC Bootloader + process of two-stage jump is required you.
I believe that it should not include the option of ATTINY to Tiny PIC Bootloader +.
Best regards,
Dan
Dear Edorul. and All.
This is a review of the two-stage jump ATTINY, but I found a solution.
Flash memory of ATTINY has circulation.
There is a need to modify the description to jump to the bootloader.
.org 0x0000
RJMP IntrareBootloader
------>
.org 0x0000
RJMP PC-0x60 ;goto IntrareBootloader
However, this description is an error in the compiler,
------>
.org 0x0000
.dw 0xcf9f ;goto IntrareBootloader
I think you have not tried, but only in ATTINY13A, ATTINY45/85 even and probably work.
I attach the source of the bootloader with improved.
Best regards,
Dan
Last edit: Dan 2013-06-27
Hello Dan !
It's good to hear that you've find a workaround to make ATTINY13 working with "Tiny (PIC) Bootlader+" !!!!!
But I've some questions and remarks:
Questions:
- is there a way to modify ".dw 0xcf9f" with something more portable like:
.dw CODE_FOR_RJMP+(MAX_MEM - BOOTLOADER_SIZE) ?
- when using your ATTINY13A bootloader firmware, do you need to make some changes in the application source code?
- in your "template_attiny13A.asm" there is "#define W_TBL". It seems it isn't used with "Tiny (PIC) Bootloader+", so what is its purpose?
Remarks:
- your "//**" in the PC source code is a very good idea!
- you should create new families for AVR. For example "#A" for tinyAVR, "#B" for megaAVR... So in the PC software it will be easier to test if it's AVR or PIC device (if "family start with '#'" then "it's AVR" else "it's PIC")
- beware when you try to load ".eep", you must verify if the device is a PIC or an AVR. You should also test if the file exists.
- I don't understand why you define "selectedPicInfos.eepromflag=10" and "selectedPicInfos.eepromflag=0" as it's never used.
I think I had other questions and remarks but I can't remember them :-p
Best regards,
Edorul
Dear Edorul,
I will answer a few questions.
It would appreciate advice.
Q1
- is there a way to modify ".dw 0xcf9f" with something more portable like:
.dw CODE_FOR_RJMP+(MAX_MEM - BOOTLOADER_SIZE) ?
RJMP k
PC=PC+k+1
Bit notation
1 1 0 0 k11 k10 k9 k8 k7 k6 k5 k4 k3 k2 k1 k0
I think this description is good.
define CODE_FOR_RJMP 0xc000 ;Constant
define CURRENT_POSITION 0x0fff ;Constant
define BOOTLOADER_SIZE 0x0060 :Variable
.dw CODE_FOR_RJMP+(CURRENT_POSITION - BOOTLOADER_SIZE)
Q2
- when using your ATTINY13A bootloader firmware, do you need to make some changes in the application source code?
Not necessary to rewrite the source code, but must make assumptions PIC forth.
Conditions envisaged two.
1.in application source code's address:0x000 = ("RJMP user_program" or "RCALL user_program")
rewrite 0x0000 ".DW CODE_FOR_RJMP+(CURRENT_POSITION - BOOTLOADER_SIZE)"
write 0x019c "LDI zl,low(user_program)"
write 0x019d "LDI zh,high(user_program)"
write 0x019e "IJMP" ;jump to (z)
or.
write 0x019c "RCALL user_program" ;Need to re-calculate the relative address
2.in application source code's address:0x000 != ("RJMP user_program" or "RCALL user_program")
rewrite 0x0000 ".DW CODE_FOR_RJMP+(CURRENT_POSITION - BOOTLOADER_SIZE)"
write 0x019c Same code and 0x000
write 0x019d "LDI zl,low(0x0001)"
write 0x019e "LDI zh,high(0x0001)"
write 0x019f "IJMP" ;jump to (z)
host has been rewritten if pic, but has not been rewritten in remodeling my host.
It specified in the template.
!!! Very good to be able to change the host as pic !!!
Q3
- in your "template_attiny13A.asm" there is "#define W_TBL".
It seems it isn't used with "Tiny (PIC) Bootloader+", so what is its purpose?
There is a reason it is to have defined in the template W_TBL.
For example, useful, for example, when you want to temporarily change the allocation of port TX, the RX.
bootloader since they are compiled together when you compile by defining W_TBL,
you can not use the bootloader, but the process of writing can be shortened.
Q4
- beware when you try to load ".eep", you must verify if the device is a PIC or an AVR.
You should also test if the file exists.
The host of my current, I will generate an error that there is no eep file even if there is no need to write EEPROM.
I am generating eep file to force wait at the Tenplate is currently.
What should I do to do not want to open the eep file when you do not need to write the eeprom?
Q5
- I don't understand why you define "selectedPicInfos.eepromflag=10" and "selectedPicInfos.eepromflag=0" as it's never used.
It is provided to distinguish write eep file writing and hex file this variable.
If not provided this variable, flash area will be written twice for some reason.
What you want of me,
1.Do not open eep file when "write EEPROM" is not selected.
2.hex file is written only flash area, EEPROM write only the eep file.
Please give me good advice.
Best regards,
Dan
Dear Edorul,
I will correct the case 2.
write 0x019c Same code and 0x000
write 0x019d "LDI zl,low(0x0001)"
write 0x019e "LDI zh,high(0x0001)"
write 0x019f "IJMP" ;jump to (z)
------->
write 0x019c Same code and 0x000
write 0x019d ".DW CODE_FOR_RJMP+((CURRENT_POSITION + BOOTLOADER_SIZE + 4) & 0x00FF)"
019d ---> cfff
019e ---> c000
01fe ---> c060 ;+0x60
01ff ---> c061
0000 ---> c062
0001 ---> c063
0x0fff+0x0060+0x0004=0x1063
0xc000+(0x1063 & 0x00ff)=0xc063
Best regards,
Dan
Last edit: Dan 2013-06-27
Hello Dan!
Thanks for your answers :-)
I've made some changes to your code (I've mainly added a "#A" family for tinyAVR and separate it from PIC "B" family). They are between "//$$" lines. I've added some questions for you between "???".
Please take a look at them and tell me if it works.
Best regards,
Edorul
Dear edorul,
I will report the test results.
I was working by changing the jump address of 0x0000.
gotoAsmAddress = 0xCFFF - (selectedPicInfos.bootloaderSize-8)/2;
I was implemented from the rewriting address 0x019C.
I also changed the template and sample programs accordingly.
There is no change bootloader with out ID PIC code.
I have shown in the //!! Change my place.
I will answer a few questions.
1.The default size of the boot loader.
It is expected to be 16 words shorter case of hardware uart.
100-16=84
2.EEPROM DATA
.eep(ATTINY13A)
:03000000718253B7
:00000001FF
.hex(pic12f1822)
:10E1D0008900C2003E003E0000003C003C008E0072
:10E1E000F30090004D008A00AE009700B9000000D7
:0CE1F0003E00530074006F00700000003F
:00000001FF
epp is a byte notation.
I've used three ATTINY instructions in the source.
LDI rXX,k XX=16_31(0_F)
Bit notation
1 1 1 0 k7 k6 k5 k4 r3 r2 r1 r0 k3 k2 k1 k0
zl=r30 r3=1 r2=1 r1=1 r0=0
zh=r31 r3=1 r2=1 r1=1 r0=1
IJMP
Bit notation
1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 1
ICALL
Bit notation
1 0 0 1 0 1 0 1 0 0 0 0 1 0 0 1
Sample program was working correctly all.
If RJMP, if RCALL, operating in the absence of any RJMP RCALL but was also able to confirm the code of 0x0000 in the sample program.
Please see the attached log for more information.
Best regards,
Dan.
Last edit: Dan 2013-06-28
Dear Edorul. and All.
1.Create a new bootloader for ATTINY2313, it was confirmed the operation.
ID=0xF2,size=84byte
2.Attached is a sample program that you used to operation check.
3.I have fixed a few bugs of TinyPicBootloader +. Exe(Modifications_0.2)
"//--" Change places in my shows.
4.I modify part of the template for ATTINY13A (Rev2)
.org 0x019C RJMP --> IJMP
Best regards,
Dan
Hello Dan!
It's great you've created bootloader firmware for ATtiny2313 :-)
As ATtiny13 is without UART, and as ATtiny2313 has an UART, can all ATtiny devices be used with your bootloader firmwares?
About "Modifications_0.21":
- if I understood, "#define W_TBL" can't be used with "Tiny (PIC) Bootloader+"? Is it usefull to put "template_attinyxxxx.asm" files in the "Tiny (PIC) Bootloader+" archive?
- in "Form1.cs", I've moved
from "transfertHexToArray(string[] lines)" to "configureTransfert()" function. I hope it isn't a problem.
- can you verify in "Form1.cs" all the lines with "???" if they are OK, and then delete "???...???" to show it has been verified?
When you think tinyAVR bootloader is OK, I'll publish it with "Tiny (PIC) Bootloader+" :-)
Best regards,
Edorul
Hello again!!!
I've just saw that when I moved
from "transfertHexToArray(string[] lines)" to "configureTransfert()" function, I've left an error as "extendedAddress" variable was not declared in this function.
So I've added:
Dear Edorul.
I will answer a few questions.
Q1
- if I understood, "#define W_TBL" can't be used with "Tiny (PIC) Bootloader+"? Is it usefull to put "template_attinyxxxx.asm" files in the "Tiny (PIC) Bootloader+" archive?
A1
I think that there is no need to include in the archive template of assembler.
Q2(in source)
const int familyAvrA_DefaultBootloaderSize = 200; //???I'm not sure???; // in bytes
A2
const int familyAvrA_DefaultBootloaderSize = 168;
Q3(in source)
const int familyAvrA_DefaultBlockSize = 32; //???I'm not sure???; // in bytes
A3
meny attiny chip has 16words, so I think 32 bytes is good (provisional)
ATtiny44A/84A=32words
Q4(in source)
// ???test for config data with tinyAVR, is it usefull??? --->
A4 I think this part is good-PIC limited.
Q5(in source)
// write block size 32 ???I'm not sure???
A5
Same Q3
Q6(in source)
// ???it's wrong, can you fix it??? --->
A6
Fixed
Q7(in source)
tempInfos.eepromMem *= 2; // ???I'm not sure if it's usefull for tinyAVR??? for "tinyAVR" family EEPROM addressing is in words and not bytes
A7
The live better defined as well as the TYPE-B is less change in the program.
Q8
When you think tinyAVR bootloader is OK, I'll publish it with "Tiny (PIC) Bootloader+" :-)
A8
Remaining Issues
1.With only HEX file, operation confirmation when the EEP file does not exist.
2.Checking the operation ATTINY8X,16X constraints RJMP is a problem.
Can be placed at the end of the flash memory the boot loader?
And it can be accessed in one instruction word here Really?
I purchased a ATTINY816A.
[My View]
1.ATTINY is easy to do is transplant the boot loader compared to PIC.
2.Type write page size and erase block size is different exists, it will be able to fit into 84 bytes.
3.There is a feature called bootloader support the ATMEGA, but for this, it is studying.
Thank you very much new host programs.
And reports the results to try.
Best regards,
Dan
Last edit: Dan 2013-07-02
Dear Edorul.
I tested the Modifications_0.3.
Including the processing of EEP file, it was working perfectly.
After, we will I offer a boot loader ATTINY816A.
RJMP negative direction but is good and willing to work well even ATTINY816A...
PS,
Forum of the microchip, there was a question concerning the compatibility of MPLABX and pic18F26k22.
It seems to work fine in PIC16F1508.
It will not be answered by me, has been directed to this place, but I think that pleased even if the direct answer.
Amissing
http://www.microchip.com/forums/m727037.aspx
Best regards,
Dan
Dear Edorul.
Test of ATTINY861A has been completed.
Definitely relative jump, I will work properly.
I have written correctly in the region greater than 257 EEPROM.
I attach the latest firmware of the three types.
I decided on its own in this place ID.
Please check the source code for more information.
I assume by default = 84.
$F1, #A, ATTINY 13A, $400, 64, 200, 32,
$F2, #A, ATTINY 2313A, $800, 128, default, 32,
$F3, #A, ATTINY 4313, $1000, 256, default, 64,
$F4, #A, ATTINY 261A, $800, 128, 200, 32,
$F5, #A, ATTINY 461A, $1000, 256, 200, 64,
$F6, #A, ATTINY 861A, $2000, 512, 200, 64,
Best regards,
Dan
Last edit: Dan 2013-07-05
Hello Dan,
You're incredible: how have you created a working bootloader for many ATtiny devices so fast?!?!?
I'll change "Form1.cs" with your answers and upload your new version of "Tiny PIC/AVR Bootloader+".
Thanks a lot for everything :-)
Best regards,
Edorul
Last edit: edorul 2013-07-06