I am working towards bootloading a PSOC 3 with a 3rd party microcontroller over SPI but having some compiler trouble. There is a sample project AN84401 that I am using as a guide. For now, I am just trying to use this sample project to bootload a psoc 3 with a psoc 3 bootloader host since that is closer to what the sample project does, so I can verify things are working one step at a time. I was able to get my bootloader/bootloadable code to compile, but not my bootloader host project. The particular line of code that it doesn't like is:
static FILE* dataFile;
but FILE* does not show up in blue. The error it is giving me is "Build error: missing ";" before "*"
I have tried a lot of things, such as adding #include "stdio.h" and #include <stdio.h>, because I thought it might have been something related to that why it doesn't show the FILE* type name in blue. I was also using PSOC Creator version 3.0, and I read that there are some issues with includes in that version, but I had the same problem in 2.2 when I tried it there. Originally the bootloader host project was written for a psoc 5. I have made a new project for psoc 3, but am using the code from the original project which performed the bootloader host on a psoc 5. Is this somehow related to my problem? I had not modifiied this particular file (cybtldr_parse.c) so I would expect this to be working code. It sounds like it is something related to my compiler or my includes, but I am really not sure. The only code modifications I have done to the projects are eliminate the LCD display objects, comment out the code associated to them, and add LED indication because I do not have an LCD on the boards I am working with. Any input on this would be appreciated. I would like to see this bootloader host work.
Solved! Go to Solution.
There are no 'files" in PSoC's world (except a component em_File which is able to read from an SD-card). Files usually need an operating system.
I strongly suggest you to view the documentation here www.cypress.com/. Additionally you should update Creator to the latest version (actually 3.0 SP1)
I compiled this under ARM GCC 4.7.3 and received no errors.
And my ...._parse file also has the same typing as your error is complaining about.
Your project works for me. I must be making a mistake somewhere when I rebuilt this into project for psoc 3. Are there any obvious reasons why this code set would work for a psoc 5 project and not a psoc 3 project?
I checked the compiler settings in my project, and it is the 8051 keil compiler, and not the ARM GCC compiler. This is apparently just my lack of knowledge of the differences in compilers and their capabilities, and the reason I can't use this code for a psoc 3. I didn't realize there were such large differences in what types of code you can run between them. Thanks for the help.
Maybe an issue with Keil and how it handles statics ?
I just tried it witrh Keil, sure enough got same error.
Contact Keil support, or file a CASE at Cypress and have them
interface to Keil -
To create a technical case at Cypress -
“Create a Case”
You have to be registered on Cypress web site first.
After looking through the sources: remove the dataFIle variable and the functions that use them. AFAICS they are never used... (dataFile gst set by CyBtldr_OpenDataFile, and I cannot find any reference to it in the original project)
I will try that.
Is this code referencing the dataFile pointer included to dynamically load the CYACD file as opposed to using the CYACD-to- stringimage tool which preloads the code into the stringimage.h file? I was using the tool anyway.
Success! Thanks to all of you for the help. I hadn't noticed that those couple of functions weren't being used. Commenting them out worked. My issue is solved, but I guess there is still the question for your people what that other issue with the static file pointer was. Hopefully you get that figured out.
I guess that since the 8051 does not run an operating system, the compiler just doesn't deliver a 'FILE' type definition in its stdio.h. So the compiler just throws an error (even though its not the one I would expect).
It might be that originally the CYACD-to-string-array convesion was done by these functions, and the code was re-used for a gcc running on a PC.
Or the host was originally thought to run on a PC - maybe it got carried over from the UART-on-PC version of the boot loader host?
Just a thought, but in general file your own CASEs, that eliminates a forum
supporter from being an intermeadiary and causing you further delay.
Sometimes a forum supporter will file a CASE as well because of their
own interest, but don't let that stop you as well. Especially in light often
one question may lead to another and via CASE you have a direct line to
I am not sure if I should create a new post for this, but I have gotten father along on my project. I have a new problem now.
I have gotten both the bootloader host and bootloader running, but not yet completing its communication process. After the master does the CreateEnterBootloaderCmd, it sends the data down SPI to the slave. Originally I wasn't getting anything back from this command, and so I added the SS pins on both the host and bootloader/bootloadable projects to see if that would make a difference. Now, I am getting a response but the data read back is junk and returns an error. It seems like when I re-run the host program I will get different results in the return packet. I can't seem to make sense of what is wrong. I have triple checked my hardware connections and they seem ok, but I am not ruling that out. There must be an explanation for what it is reading from the slave. I don't have a scope with me now but I will be checking it on Monday with a scope.
If anyone with a lot of SPI or bootloader experience can help me make sense of this, I would be very grateful. Thanks.
Here is a copy of my outgoing data packet from the master.
0 0x01 '\001' 0x0000015F (XData) unsigned char
1 0x38 '8' 0x00000160 (XData) unsigned char
2 0x00 '\0' 0x00000161 (XData) unsigned char
3 0x00 '\0' 0x00000162 (XData) unsigned char
4 0xC7 '\307' 0x00000163 (XData) unsigned char
5 0xFF '\377' 0x00000164 (XData) unsigned char
6 0x17 '\027' 0x00000165 (XData) unsigned char
I ran it again with the same compile and got this in response:
0 0xFE '\376' 0x0000035F (XData) unsigned char
1 0x08 '\b' 0x00000360 (XData) unsigned char
2 0xC0 '\300' 0x00000361 (XData) unsigned char
3 0x22 '"' 0x00000362 (XData) unsigned char
4 0x03 '\003' 0x00000363 (XData) unsigned char
5 0x18 '\030' 0x00000364 (XData) unsigned char
6 0x83 '\203' 0x00000365 (XData) unsigned char
7 0xEF '\357' 0x00000366 (XData) unsigned char
8 0xC6 '\306' 0x00000367 (XData) unsigned char
9 0x03 '\003' 0x00000368 (XData) unsigned char
10 0x01 '\001' 0x00000369 (XData) unsigned char
11 0xFE '\376' 0x0000036A (XData) unsigned char
12 0x39 '9' 0x0000036B (XData) unsigned char
13 0x81 '\201' 0x0000036C (XData) unsigned char
I just want to check if your issue has been resolved. If not please attach the projects. If the issue is complex we can open a technical support case on your behalf to solve your issue.
After further inspection with a scope I believe I have a hardware problem because I am not seeing the SPI clock and data signals that I am expecting at the pins. I need to get that resolved. I am not sure if it is a physical connection issue or a pin mapping problem. It doesn't look like a software problem.