This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Dear Jagadish, I have the following questions. Looking forward to your help to reply. Thank you.
Thank you. Hope you reply soon as I hope to try out tomorrow. Thanks for your support
Dear Jagadish
I am unfamiliar with ymodem and try to read online about it. But the info is quite sketchy. Below is a ymodem protocol in the software:
What is the FF, FD, FC , FB in the above example transfer? I have a 600kbytes of binary code to flash. 600=0x258 . It is more than FD long. How to handle the transfer? I take it that FD, FC ... will decrement until 0? That will be 253 packets only!
Looking forward to your reply. Thank you
Dear Jagadish
Regarding the ymodem protocol, I have since read something about it and understood it. I got the protocol eg above from bl_ymodem.c comments. I realise that the comments got errors. The hex code after block number should be 2's compliment of block number. So STX 01 FE Data[1024] CR1 CRC2 should be correct and not STX 01 FD .... Also if the block number reaches 255, and there are more blocks to send, it will simply rollover and start from block 0?
I would like to test bootloader uart with a PC application. Can you recommend an application?
Looking forward to your reply. Thank you
Dear Jagadish
Looks like I can't test using HDK? I realise that the HDK has only one uart port with is used for flashing the software on the mcu. I will need another serial port to send data to the mcu for flashing on the api bank. Please advise if there is another uart that I can configure on the hdk.
Looking forward to your reply. Thank you
Hi LayEng,
I would like to test bootloader uart with a PC application. Can you recommend an application?
You can download the PC application "Tera Term" from below link:
Download Tera Term - free - latest version (softonic.com)
Looks like I can't test using HDK? I realise that the HDK has only one uart port with is used for flashing the software on the mcu. I will need another serial port to send data to the mcu for flashing on the api bank. Please advise if there is another uart that I can configure on the hdk.
You can do it from HDK board as well. Actually, it is not different UART, the same UART which is used for flashing the software will only use to send the application binary to the bootloader code.
I will suggest you to follow the steps in below link:
(+) [FAQ] TMS570LC4357: Step by step procedure to execute UART Bootloader on TMS570LC4357 - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums
--
Thanks & regards,
Jagadish.
Dear Jagadish
Thank you for your reply. I would like to adapt your code for our application. But I am always stumped by the first line. I have asked you twice but didn't get a reply from you. Hope you can help to reply as I believe not adding this code will not work but I must know what I am adding. Below is the code:
/* Copy the flash APIs to SRAM*/
memcpy(&apiRunStart, &apiLoadStart, (uint32)&apiLoadSize);
Looking forward to your reply. Thank you
Dear Jagadish
This is an unrelated question. I have previously had a lot of exchanges regarding I2C. How do I access those exchanges? Looking forward to your reply. I also have another question. Every response from you or me has a selection for "This resolved my issue". Up till now, I am quite terrified to select that as I am afraid it will close the case when I am not ready. Is it to respond to that specific reply you gave or is it to close the case? Very sorry for being very sparing in selecting it. Looking forward to your reply
Dear Jagadish
I have more questions regarding the sample bootloader.
1. I notice the crc calculation is in asm. Can you give me a sample code with lookup table?
2. What is the polynomial used in the sample code? Is it 0x1021?
3. I need to flash the eeprom of mcu. Can you tell me how to do it?
4. Can I say that the ram size of both bootloader and application are the same? They are separate software using the same amount of resources?
Looking forward to your reply. Thank you
Dear Jagadish
I forgot to add one more question
1. We would like to program the eeprom of the mcu. Please explain how to do it. Can it be combined with the application program flash?
Looking forward to your reply. Thank you
Dear Jagadish
I just flash using hdk using the sample code. It works. What is the seed value of the crc? Looking forward to your reply. Thank you
Dear Jagadish
Sorry for asking you so many questions. In our application, rs232 port is assigned to SCI4 instead of SCI1. Is there any problem if I were to change
#define UART sciREG1 /* Use UART port 1 for UART boot */
to
#define UART sciREG4 /* Use UART port 4 for UART boot */
?
If no, what other changes should I take care of. Looking forward to your reply. Thank you
Hi Jagadish
Sorry for asking you more questions. I hope that when you have time, you will answer all of them.
1. Is there an eeprom programming utility for TMS570LC4357?
2. For programming eeprom using bootloader, is there a sample format for data transmission? Eg block1, number of data, data contents, block2 ...
Dear Jagadish
Can the ccs program the eeprom directly? Or you need a patch which actually serve to write the eeprom directly using the fee api?
Looking forward to your reply.
Can the ccs program the eeprom directly? Or you need a patch which actually serve to write the eeprom directly using the fee api?
No, CCS can't program EEPROM directly. You should use FEE api routines.
Dear Jagadish
Thanks for your reply. However, I have so many questions up there. I shall summarise here:
I notice the crc calculation is in asm. Can you give me a sample code with lookup table? If not, what is the polynomial used in the sample code? Is it 0x1021? What is the seed value?
I need to flash the eeprom of mcu via bootloader. I have to use FEE api and transfer the data via ymodem using a self defined format?
Can I say that the ram size of both bootloader and application are the same? They are separate software using the same amount of resources?
Looking forward to your reply. Thank you
Dear Jagadish
I have 2 questions wrt halcogen
1. hl_sys_link.cmd is generated by halcogen. Which tab in halcogen do you define it?
2. I would like to remove ethernet drivers namely, the emac drivers. I see that emac drivers are not enabled in TMS570LC4357ZWT->Driver Enable tab. Where else should I disable/uncheck for the files to be not generated?
Looking forward to your reply.
Hi LayEng,
"What is apiLoadStart . It seems to imply start of flash api but how is this flash api compiled and what is the content of this flash api. If my understanding is wrong, please correct."
I found the answer. I need to understand hl_sys_link.cmd before I can continue further but it is enough for me to proceed.
It is a linker symbol that represent a start of the address of the flash where the section called "flashAPI" will be stored in the flash. And by externing this symbol again in main.c file we can just copy this flash API routines saved in the flash to the RAM.
You can also have a look on the below two threads:
I notice the crc calculation is in asm. Can you give me a sample code with lookup table? If not, what is the polynomial used in the sample code? Is it 0x1021? What is the seed value?
I don't think we have this, let me discuss with my colleague to confirm it.
I need to flash the eeprom of mcu via bootloader. I have to use FEE api and transfer the data via ymodem using a self defined format?
You can do that, for this you just need to understand the how we are decoding the YMODEM protocol in UART bootloader
And in the same way you can receive the data from Hyper terminal and then at the end you should need to modify the code to write into the EEPROM memory instead of flash Bank-0.
Can I say that the ram size of both bootloader and application are the same? They are separate software using the same amount of resources?
Yes, your understanding was correct.
I need to use SCI4 for uart for my hardware. Still trying as just changing sciREG1 to sciREG4 don't work.
Make sure to configure baudrate properly.
Make sure to configure the PINMUX window properly for sciREG4.
Make sure you are using correct pins to connect to the serial terminal tool.
1. hl_sys_link.cmd is generated by halcogen. Which tab in halcogen do you define it?
It doesn't have any tab to customize the values from HALCoGen. You just need to modify the .cmd file directly from CCS based on requirements.
And also remember your modifications will overwrite if you generate the code again from HALCoGen unless you written your code in the "USER CODE" section.
2. I would like to remove ethernet drivers namely, the emac drivers. I see that emac drivers are not enabled in TMS570LC4357ZWT->Driver Enable tab. Where else should I disable/uncheck for the files to be not generated?
You can disable them from below tab
But remember one thing, once you enabled the check box and generated the any driver files, after you uncheck and regenerate the code will not helpful to delete these files automatically.
You should just need to select these files manually and should delete them
--
Thanks & regards,
Jagadish.
Dear Jagadish
I am happy to inform you that I manage to get sci4reg to work on my hardware.
#define UART sciREG4 /* port for UART boot . Was sciREG1 */
I can see the data flashed in the flash memory. Please see below. But my software don't run when it jumps to 0x20020
--------------------------------
g_ulTransferAddress = 0x20020;
((void (*)(void))g_ulTransferAddress)();
-------------------------------
How to compare the binary of flash memory and bin file? I saw that there is a utility for saving flash memory of ccs. I did try but the results are strange. Do you have user guide?
Looking forward to your reply. Thank you
I can see the data flashed in the flash memory. Please see below. But my software don't run when it jumps to 0x20020
What should your application software do?
Does it involve any interrupts?
Did you just test your application software without bootloader, by programming it at 0x0 address?
--
Thanks & regards,
Jagadish.
Dear Jagadish
My application is to control some motors. We have spent the last 9 months developing it. It involves interrupts. We have been using ccs to debug our code. When clicking the debug button ( the beetle icon), it will auto load the .out file and go to main(). The binary file is generated using this tool cmd:
"${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/armofd.exe" "${CG_TOOL_ROOT}/bin/armhex.exe" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe"
I use the bootloader to flash the bin file to location 0x20020 .
1. Theoretically it should work. But it didn't. We have some LED which will flash a number indicating the state of the motor. Normally it does but using bootloader loaded image, it doesn't. It also didn't respond to external switches.
2. I would like to test the binary file (.bin) by loading it, instead of using the .out file. Can you tell me how to flash? I read from forum that there is a uniflash tool but don't know how to use it.
Looking forward to your reply. Thank you.
Dear Jagadish
I manage to download uniflash tool and install it and use it to flash the bin file that the bootloader use. My bin file works with uniflash but not with bootloader. Through spending one morning of checking the flash memory of bootloader image file (starting from 0x20020) and the application flash memory, I find they are both identical. So the flashing using bootloader is ok but the application running via bootloader is nok.
Looking forward to your inputs. Thank you
Hi LayEng,
Please verify below thread
And please make sure to perform the workaround that i suggested in the last comment.
--
Thanks & regards,
Jagadish.
Dear Jagadish
Are you referring to the work around below?
I would like to add that we have a lot of init functions. If we copy it to here, then our bootloader file would be quite big unlike your sample application. Perhaps you suggest which init should be added in the sys startup of bootloader. I don't understand about the reply from the other guy who say a reset resolve his application.
Are you referring to the work around below?
Yes.
I would like to add that we have a lot of init functions. If we copy it to here, then our bootloader file would be quite big unlike your sample application.
If you concern about code size, then please cut it at other parts and add them into the /* USER CODE BEGIN (22) */.
But this modification is important to work interrupts and other system initializations in application code.
Dear Jagadish
Sorry for opening so many threads as I would like to separate my problems/questions into different threads so that I can close the thread if resolved.
Regarding to my question above, any updates? I have done what you recommended in the image above. Add the 4 lines of code at hl_sys_startup.c
But still my original code at location 0x20020 won't run. Looking forward to new inputs from you
Sorry for opening so many threads as I would like to separate my problems/questions into different threads so that I can close the thread if resolved.
Understood no problem.
But still my original code at location 0x20020 won't run. Looking forward to new inputs from you
Is it okay to share your complete project so that i can try to debug at my end.
Dear Jagadish
I have been reading flash banks. When the program starts from address 0x00, it is in flash bank0. The first address of flash bank1 is 0x20 0000. But the code says application address starts from 0x20 000 . I
//*****************************************************************************
// The starting address of the application. This must be a multiple of 32K(sector size)
// bytes (making it aligned to a page boundary), and can not be 0 (the first sector is
// boot loader).
//
// The flash image of the boot loader must not be larger than this value.
//*****************************************************************************
#define APP_START_ADDRESS 0x0020020
//*****************************************************************************
// The address to store the update status of the application image
// It contains Application Start Address, Application Image Size, etc
//
//*****************************************************************************
#define APP_STATUS_ADDRESS 0x0020000 //contains 32 bytes of info before APP_START_ADDRESS.Starts with 0x5A5A5A5A,
Could there be a mistake in the definition? 0x002 0000 vs
0x0020_0000 |
?
Please reply. Thank you
Dear Jagadish
I tried flashing to flash bank 1 which is at 0x20 0000 . It also doesn't work. So I don't know what to do. It looks like there is a need to put the new application vector interrupt address in bootloader? Looking forward to your reply. Thank you
Dear Jagadish
"Is it okay to share your complete project so that i can try to debug at my end."
Our project is confidential and we can't pass our code to ppl outside the company. Even external vendors have to visit the company to debug with us so as to prevent loss of data. What is essential for the software to work is actually the halcogen source and include file. I think I can share that with you. We are not using the sys_main in halcogen. We have our own main like the bl_main.c . Please let me know if that is workable. We have timer interrupts, CAN bus interrupts, IO interrupts, pwm interrupts ... These interrupts must work for the entire code to work.
Secondly you don't have our hardware. How are you going to simulate? Using HDK?
Please let me know if having the halcogen files can help you to develop some code whereby you can show that all the necessary interrupt works.
Looking forward to your reply. Thank you
Dear Jagadish
The other thread that you ask me to look at for your work around. I got in touch with them and they say do a force reset in the flashed application. Is there a way to do forced reset using this instruction below without it being cyclic or repetitive ? Meaning it won't go into perpetual reset.
sl_systemREG1->SYSECR = ((uint32)0x2u << 14u);
Looking forward to your reply. Thank you
Could there be a mistake in the definition? 0x002 0000 vs
tried flashing to flash bank 1 which is at 0x20 0000 . It also doesn't work. So I don't know what to do. It looks like there is a need to put the new application vector interrupt address in bootloader?
Yes, it is not the mistake. It is intentional only. The application start address will be choose based on the size of the bootloader. On our code the bootloader is less than the 0x20000, so we choose the application start address 0x20000.
My suggestion would be is, please try to provide application and your bootloader codes on private chat. Or at least try to create a simplest project with the issue then i will debug and will provide you workaround.
--
Thanks & Regards,
Jagadish.
Dear Jagadish
My company email is layeng.chan@stengg.com . Please let me know how to reach you.
I was looking at some codes on intvecs.asm . This is from something I saw in another project.
#define DCU_APP_START_ADDRESS 0x002000A0
How do you modify the jumps as shown above in the sample uart bootloader code which I got from you? Looking forward to your reply
Dear Jagadish
I saw this in another thread. It is from your colleague Wang QJ. Maybe he can help to reply the above question from me which is how to modify the intervecs.asm
Dear Jagadish
My application code which has 0x20 bytes of intervec data has the following code as seen from memory browser
Below is the map file:
I sent you a friend request, please accept that so that we can chat in private window and can share the codes.
Dear Jagadish
I can't see the friend link in my notification. How to access the private link? I can't access the company email outside of office hours.
Dear Jagadish
I manage to get the link via company mail forwarded to my pte email. I have uploaded the bootloader and app code
Hi LayEng,
Thanks for providing your codes on private chat.
I verified and found the below observation:
The application code is starting from 0x00000020, if we program like this then this application will overwrite the bootloader code right?
So, i changed the linker file of the application code you provided:
After doing above modification in linker file, first i programmed the UART bootloader and then using that bootloader i sent the application binary through Hyper terminal and i observed now everything is working as expected.
I am sending my tested projects to you over private chat, so please test them as it is and update me.
--
Thanks & regards,
Jagadish.