- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a PSoC 4 and a PSoC 5 and am able to run programs on both boards via PSoC Creator 4.3, however I need to do this via a batch file and can successfully do this for the CY8CKIT-059 but not for the CY8CKIT-043. In both cases I create a script and when I run this script using ppcli.exe, I don't get any errors.
I can then execute using gdb and all works as expected for the CY8CKIT-059, but not with the CY8CKIT-043. If I flash the CY8CKIT-043 via the PSoC Creator, then my program runs using gdb.
I have attached part of my batch file, that show how I am creating the scripts for both boards.
Any idea what I am doing wrong?
Thanks in advance.
Mark
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
Adding my response on the thread too:
As your project does not have the code in a loop the main() function gets executed as soon as you start the gdb session and thus the debug pointer is stuck at the while(1) condition in Cm0Start.c file after executing the main() code.
Two methods can be used as a workaround and I have provided the snapshot and commands used:
Method 1 -
1. Declare a volatile variable in main.c, for example - volatile uint8_t stop_var = 0x00;
2. Add a while loop before the execution of your application code - while(stop_var==0x00); before ldra_port_open();
3. Add a break point at the while(stop_var==0x00). Use the step command to stop the execution at that point.
4. Change the variable value of stop_var to 0x01 using command set variable stop_var = 0x01
5. Step through the code.
I have attached the project archive. A snapshot of gdb commands is shown below -
Method 2 -
1. This is very similar to the previous method.
2. Declare a volatile variable in main.c, for example - volatile uint8_t stop_var = 0x00;
3. Add a while loop at the end of your application code - while(stop_var==0x00);
4. Add a breakpoint at the while(stop_var==0x00). Use the step command to stop the execution at that point.
5. Add a breakpoint at main using the command b *main and then jump to main using jump main command.
6. Step through the code.
I have attached the project archive and snapshot of gdb commands is shown below.
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
Can you please let me know at which point the script fails? What is the error that you are getting?
when I run this script using ppcli.exe, I don't get any errors.
If that is the case then the script is generated properly. Is it possible for you to attach the entire bat script and the scripts that get created so that we can try and debug the issue?
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
I used the script that you gave and tried programming and it worked. Later I modified that batch script that you had shared and hardcoded all the variables accordingly and then tried programming the device.
I was able to program the device. As I did not know what your hex file contained I created a blinky project and used that hex file instead. I have attached the edited .bat script, .cli file that was generated by the batch script and the hex file that I used to program the device.
Please try it at your end and let me know if you are able to program the device.
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It seems like the programming is working, but the execution from a batch file using gdb is not working for the PSoC 4. It only works if I have just debugged via PSoC Creator and if I don’t reprogram via my batch file. With the PSoC 5 it always works.
Using gdb, if I try to single step, then unless I have just debugged via the PSoC Creator, it just hangs.
This is the part of my gdb script, where I try to establish connection with the target and where possibly some extra monitor command is required?
set remotetimeout 5
target remote | "C:/PROGRA2/Cypress/PSOCCR1/4.3/PSOCCR~1/bin/cypsocdebugger.exe" -t PPIO:KitProg/11160FEB02105400:1
monitor reset
Any idea why this is working for the PSoC5 but not for the PSoC4?
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
I apologize for the delay.
I was able to run the gdb session on the CY8CKIT-043 and on the CY8CKIT-059 with the same commands. This is a screenshot of the debugging session on the CY8CKIT-043 -
Commands -
set remotetimeout 5
target remote | C:/Program\ Files\ (x86)/Cypress/PSoC\ Creator/4.3/PSoC\ Creator/bin/cypsocdebugger.exe -t PPIO:KitProg/1A06163201324400:1
monitor reset
I noticed that you have ~ sign in your path. Can you rename the folder so that it does not have any special characters? Can you confirm your path again?
Also, please share the error that you are getting. I am not able to access the image that you have attached.
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
First of all thanks again for trying this and replying, it is greatly appreciated. The ~ was in the path, since I tried to use the windows short path in case that made a difference. With the PSoC4, I get the gdb command, but when I type s to single step, it just hangs, where as with the PSoC5 it advances to the next line of code.
It is very frustrating since all works fine for the PSoC5, but not for the PSoC4.
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
Can you confirm that you have loaded the right elf file?
I was able to debug the target using gdb as shown in the snapshot -
I just added the file "<path to elf file>" command along with the previous commands. Please let me know if this works for you.
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
Can you please share the .hex and .elf that you have used? I will give it a try from my end and check if I can reproduce the same issue. Meanwhile, can you please try with the .hex and .elf file that I have attached.
We received an update from our internal team that even though monitor reset is a valid gdb command it is not supported by the cypsocdebugger. Can you please remove the command and let me know if it works?
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With your project, I can single step with gdb, but with the attached it just hangs. However I can debug in PSoC Creator.
I removed the Monitor reset command, but that didn’t make any difference.
My program does not configure any components, could that be an issue?
Once again, everything works for the PSoC5, but not for the PSoC4
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
I was able to reproduce this issue with the files that you have shared. The debugging process is running. But gdb is unable to find the Cm0Start.c file -
Can you try including the directory and let me know if that helps?
My program does not configure any components, could that be an issue?
Can you please let me know what you mean by this? Are you not using any of the components?
As this is a project-specific issue can you please attach your project so that it will help in debugging this issue?
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
I found that in your main.c file you have included these files -
But these files were not included in in the PSoC Creator project explorer. So, I added the files into project explorer as shown -
I am unable to build the project as there are errors in the code -
Can you please share your complete project again?
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
The files ldra_port.h, ldra_port_common.h, ldra_port.c, ldra_port_common.c are still not included into the project.
Can you please right-click on the Header Files/Source Files folder and add the files into the Workspace Explorer of PSoC Creator as shown -
Meanwhile, I have shared your project with our internal team and they are looking into this issue. I will respond on this thread as soon as I get an update.
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mari_3596111,
Adding my response on the thread too:
As your project does not have the code in a loop the main() function gets executed as soon as you start the gdb session and thus the debug pointer is stuck at the while(1) condition in Cm0Start.c file after executing the main() code.
Two methods can be used as a workaround and I have provided the snapshot and commands used:
Method 1 -
1. Declare a volatile variable in main.c, for example - volatile uint8_t stop_var = 0x00;
2. Add a while loop before the execution of your application code - while(stop_var==0x00); before ldra_port_open();
3. Add a break point at the while(stop_var==0x00). Use the step command to stop the execution at that point.
4. Change the variable value of stop_var to 0x01 using command set variable stop_var = 0x01
5. Step through the code.
I have attached the project archive. A snapshot of gdb commands is shown below -
Method 2 -
1. This is very similar to the previous method.
2. Declare a volatile variable in main.c, for example - volatile uint8_t stop_var = 0x00;
3. Add a while loop at the end of your application code - while(stop_var==0x00);
4. Add a breakpoint at the while(stop_var==0x00). Use the step command to stop the execution at that point.
5. Add a breakpoint at main using the command b *main and then jump to main using jump main command.
6. Step through the code.
I have attached the project archive and snapshot of gdb commands is shown below.
Thanks and Regards,
Rakshith M B
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content