- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I will start with attaching .ld files of bootloader (app0coreX_dfu.ld) and app1 (app1coreX_dfu.ld).
Each script is designed based on this code PSoC-6-MCU-Device-Related-Design
I am sending binary data of application via some custom protocol. The binary what I am sending is achieved by
@rem Copies the resulting linker file to a more accessible location for later merging
COPY "%OUTPUT_DIR%\%PRJ_NAME%%ELF_EXT%" "..\App1%ELF_EXT%"
@rem Populates the signature field of the application with a CRC
%CY_MCU_ELF_TOOL% -S %OUTPUT_DIR%\%PRJ_NAME%%ELF_EXT% CRC --output %OUTPUT_DIR%\%PRJ_NAME%%ELF_EXT% --hex %OUTPUT_DIR%\%PRJ_NAME%_premerge.hex
@rem Copies the signed application file to a more accessible location for later merging
COPY "%OUTPUT_DIR%\%PRJ_NAME%_premerge.hex" "..\App1.hex"
I know .elf and .hex. With the help of utility readelf I can display a variety of section information, including section sizes like this: readelf -e App1.elf. Based on this information and my linker_script.ld I am cutting of interesting things like this (ARM documentation)
@echo ----------------------------------------------
@echo Generating Binary file from Hex Intel file
@echo ----------------------------------------------
@REM # take ..\App1.hex address area 0x10040000-0x10080000 and subtract an offset of (minus)-0x10040000
@set INPUT_HEX="..\App1.hex"
@REM flash_app1_core0 - flash_app1_core1 = 0x10040000-0x10080000
@set APP1_FROM="0x10040000"
@set APP1_TO="0x10080000"
@REM offset of flash_app0_core0 + flash_app0_core1 = 0x10040000
@set OFFSET="-0x10040000"
@REM # generate a Binary file
@set OUTPUT_BIN="App1.bin"
srecord-1.63-win32\srec_cat.exe %INPUT_HEX% -Intel -crop %APP1_FROM% %APP1_TO% -offset %OFFSET% -o %OUTPUT_BIN% -Binary
Next I do upload the OUTPUT_BIN file via protocol to PSoC6 and then write down to memory, code example: Blocking-flash-write-row
Finally, I try to switch to app. I assume I cannot verify the application with DFU due to sending binary data between flash_app1_core0 and flash_app1_core1 so I just force to change to the selected application.
void switch_to_app(uint32_t appID)
{
do
{
Cy_SysLib_ClearResetReason();
} while (Cy_SysLib_GetResetReason() != 0);
Cy_DFU_ExecuteApp(appID);
}
I do check if data are valid by calculating simple checksum for binary file - in host side and PSoC6 - numbers are the same what mean it is validated.
Debugging this function I go to ...
21: int main(void)
22: {
0x1001036C push {r4, lr}
23: init();
0x1001036E ldr r4, [pc, #10] ; (10010380 <main+0x14>) <<<<<< HERE
of Disassembly and stops. The Call Stack:
sp = 0x00000000
lr = 0xFFFFFFFF
pc = 0x1600400C
Even after resume debugger, I see that this app is not working correctly. It should just blinks.
The question is, how do I correctly switch to selected app?
Thank you in advance for your help.
EDIT 1)
While loading app0_app1_merged.hex via PSoC Programmer 3.29.1 I am able to force switch app.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After some time, I found an issue in my own software while fetching (I2C) and writing data to ram buffer and then to writing this buffer to flash.
The issue was simple. I used the same "i" identifier in the outer for loop and the inner for loop - which I didn't really want to do. For future readers, remember that this is generally a bad style, is prone to confusion and should be avoided. Also remember to use better variable names than "i". I spent a week searching for this kind of mistake...
Anyway, switching from app to app is as simple as this:
void switch_to_app(uint32_t appID)
{
do
{
Cy_SysLib_ClearResetReason();
} while (Cy_SysLib_GetResetReason() != 0);
Cy_DFU_ExecuteApp(appID);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @akrupaa ,
Can you go through this code example attached below and also please refer to the middleware library
https://github.com/Infineon/mtb-example-psoc6-dfu-basic
https://infineon.github.io/dfu/dfu_sdk_api_reference_manual/html/index.html
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
yeah, i already read a lot of examples and sdk api.
As I mentioned, I have a problem with switching to the application via this SDK.
I have sent a .bin file based on a .hex generated by CY_MCU_ELF_TOOL with a custom protocol and I cannot force an application switch. I am looking for an idea where the problem may be.
Regards,
akrupaa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After some time, I found an issue in my own software while fetching (I2C) and writing data to ram buffer and then to writing this buffer to flash.
The issue was simple. I used the same "i" identifier in the outer for loop and the inner for loop - which I didn't really want to do. For future readers, remember that this is generally a bad style, is prone to confusion and should be avoided. Also remember to use better variable names than "i". I spent a week searching for this kind of mistake...
Anyway, switching from app to app is as simple as this:
void switch_to_app(uint32_t appID)
{
do
{
Cy_SysLib_ClearResetReason();
} while (Cy_SysLib_GetResetReason() != 0);
Cy_DFU_ExecuteApp(appID);
}