cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

Anonymous
Not applicable

Hi,

   

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.

0 Likes
1 Solution
ETRO_SSN583
Esteemed Contributor

Attached is my archive of the project, in case that would help.

   

 

   

Regards, Dana.

View solution in original post

0 Likes
21 Replies
Bob_Marlowe
Expert II

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)

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I am not using an SD card.  My project has nothing to do with that. 

0 Likes
ETRO_SSN583
Esteemed Contributor

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.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

Attached is my archive of the project, in case that would help.

   

 

   

Regards, Dana.

View solution in original post

0 Likes
Anonymous
Not applicable

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?

0 Likes
Anonymous
Not applicable

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.

0 Likes
ETRO_SSN583
Esteemed Contributor

Maybe an issue with Keil and how it handles statics ?

   

 

   

I just tried it witrh Keil, sure enough got same error.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

Contact Keil support, or file a CASE at Cypress and have them

   

interface to Keil -

   

 

   

    

   

          

   

To create a technical case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I will do that, thanks.

0 Likes
Bob_Marlowe
Expert II

I already filed a case.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Wonderful! even easier 🙂

0 Likes
HeLi_263931
Honored Contributor II

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)

   

hli

Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

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.

0 Likes
HeLi_263931
Honored Contributor II

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).

0 Likes
HeLi_263931
Honored Contributor II

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?

0 Likes
ETRO_SSN583
Esteemed Contributor

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

   

the solver.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Ok, I will do that in the future.  Thanks

0 Likes
Anonymous
Not applicable

 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

   
        
   
    Here is a copy of my incoming packet from the slave:   
   
    
          
    
      0 0xF2 '\362' 0x0000035F (XData) unsigned char    
    
      1 0xC4 '\304' 0x00000360 (XData) unsigned char    
    
      2 0x62 'b' 0x00000361 (XData) unsigned char    
    
      3 0x4B 'K' 0x00000362 (XData) unsigned char    
    
      4 0x01 '\001' 0x00000363 (XData) unsigned char    
    
      5 0x00 '\0' 0x00000364 (XData) unsigned char    
    
      6 0xF7 '\367' 0x00000365 (XData) unsigned char    
    
      7 0x00 '\0' 0x00000366 (XData) unsigned char    
    
      8 0xFC '\374' 0x00000367 (XData) unsigned char    
    
      9 0xC1 '\301' 0x00000368 (XData) unsigned char    
    
      10 0xC2 '\302' 0x00000369 (XData) unsigned char    
    
      11 0x00 '\0' 0x0000036A (XData) unsigned char    
    
      12 0x07 '\a' 0x0000036B (XData) unsigned char    
    
      13 0x07 '\a' 0x0000036C (XData) unsigned char    
    
      14 0x19 '\031' 0x0000036D (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

   
    Here is another one:   
   
    
      0 0xDE '\336' 0x0000035F (XData) unsigned char    
    
      1 0x00 '\0' 0x00000360 (XData) unsigned char    
    
      2 0x07 '\a' 0x00000361 (XData) unsigned char    
    
      3 0x00 '\0' 0x00000362 (XData) unsigned char    
    
      4 0x03 '\003' 0x00000363 (XData) unsigned char    
    
      5 0xDC '\334' 0x00000364 (XData) unsigned char    
    
      6 0x1F '\037' 0x00000365 (XData) unsigned char    
    
      7 0x03 '\003' 0x00000366 (XData) unsigned char    
    
      8 0xFF '\377' 0x00000367 (XData) unsigned char    
    
      9 0xBF '\277' 0x00000368 (XData) unsigned char    
    
      10 0x00 '\0' 0x00000369 (XData) unsigned char    
    
      11 0x00 '\0' 0x0000036A (XData) unsigned char    
    
      12 0x02 '\002' 0x0000036B (XData) unsigned char    
    
      13 0x07 '\a' 0x0000036C (XData) unsigned char    
    
      14 0x01 '\001' 0x0000036D (XData) unsigned char    
    
          
    
     Another:    
    
     
      0       0xFE '\376'       0x0000035F (XData)       unsigned char     
     
      1       0x25 '%'       0x00000360 (XData)       unsigned char     
     
      2       0x01 '\001'       0x00000361 (XData)       unsigned char     
     
      3       0x01 '\001'       0x00000362 (XData)       unsigned char     
     
      4       0xEF '\357'       0x00000363 (XData)       unsigned char     
     
      5       0xFF '\377'       0x00000364 (XData)       unsigned char     
     
      6       0x16 '\026'       0x00000365 (XData)       unsigned char     
     
      7       0x46 'F'       0x00000366 (XData)       unsigned char     
     
      8       0x40 '@'       0x00000367 (XData)       unsigned char     
     
      9       0x7E '~'       0x00000368 (XData)       unsigned char     
     
      10       0x03 '\003'       0x00000369 (XData)       unsigned char     
     
      11       0x02 '\002'       0x0000036A (XData)       unsigned char     
     
      12       0x05 '\005'       0x0000036B (XData)       unsigned char     
     
      13       0x03 '\003'       0x0000036C (XData)       unsigned char     
     
      14       0x01 '\001'       0x0000036D (XData)       unsigned char     
    
   
   
        
   
        
   
        
0 Likes
himam_31
Employee

Hello Kwelco,

   

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.

   

Thanks,

   

Hima

0 Likes
Anonymous
Not applicable

Hi Hima,

   

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.

   

Thanks,

   

Kevin

0 Likes