Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Arduino for PSoC support issue (Read 6616 times)
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Arduino for PSoC support issue
Mar 30th, 2017 at 2:42pm
Print Post  
Some time ago Sparkfun almost successfuly realised arduino support for Cypress PSoC family of Cortex M3 crystals. 
https://learn.sparkfun.com/tutorials/freesoc2-introduction
And it was a great progress.

To my surprize it also works with VisualMicro, except some minor bugs:
1. During compilation error msg. occures:
arm-none-eabi-gcc*: error: ase\core\core.a: No such file or directory
because core.a was putted not into core folder but into Release one. Manualy tranfer it to correct folder solves the problem.

2. Debug mode compilation also generates error:
VM_DBG.h: 42:22: fatal error: WProgram.h: No such file or directory
   #include "WProgram.h"


As my knowledge is not enougth to solve the ussues, I ask for help from developers:
1. What adjustments have to be done for correct placing core.a?

2. What  can be done to enable Debug Mode?

Thanks in advance,
Vladimir
« Last Edit: Mar 30th, 2017 at 2:52pm by Kabron »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino for PSoC support issue
Reply #1 - Mar 30th, 2017 at 10:16pm
Print Post  
I tried the install guide and it fails to compile on both the arduino 1.8.2 ide and in visual micro.

Can you explain what you have installed?

Thanks
  
Back to top
WWW  
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Arduino for PSoC support issue
Reply #2 - Mar 31st, 2017 at 8:41am
Print Post  
Well, try to compile with attached cores folder: 
Arduino\Hardware\SparkFun\psoc\cores\

I added some absent .h files from generated sources by PSoC Creator.

Indeed, the author was not precisious enougth yet.
« Last Edit: Mar 31st, 2017 at 8:45am by Kabron »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino for PSoC support issue
Reply #3 - Mar 31st, 2017 at 6:21pm
Print Post  
Thanks

To fix the core.a issue you can change the build definition to match how Arduino works.

Edit the text file called "platform.txt" in "Documents\Arduino\Hardware\SparkFun\psoc" (or wherever you installed the sparkfun definition)

I commented the original at line 60 by adding a # to the front

Code
Select All
# recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -Wl,--start-group -o "{build.path}/{build.project_name}.elf" {object_files} "{build.variant.path}/Uno_blocks.a" "{build.variant.path}/{build.variant_system_lib}" "{build.path}/core/core.a"  -mthumb -march=armv7-m -mfix-cortex-m3-ldrd -lm "-Wl,-Map,{build.path}/{build.project_name}.map" "-T{runtime.hardware.path}/psoc/cores/arduino/cm3gcc.ld" -g "-u _printf_float" ""  -Wl,--gc-sections -Wl,--end-group -lstdc++
 



Then added the creation of a variable called "archive_file_path"
Code
Select All
archive_file_path={build.path}/{archive_file} 



Then added a copy of the commented line but changing the "{build.path}/core/core.a"  to "{archive_file_path}"
Code
Select All
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -Wl,--start-group -o "{build.path}/{build.project_name}.elf" {object_files} "{build.variant.path}/Uno_blocks.a" "{build.variant.path}/{build.variant_system_lib}" "{archive_file_path}"  -mthumb -march=armv7-m -mfix-cortex-m3-ldrd -lm "-Wl,-Map,{build.path}/{build.project_name}.map" "-T{runtime.hardware.path}/psoc/cores/arduino/cm3gcc.ld" -g "-u _printf_float" ""  -Wl,--gc-sections -Wl,--end-group -lstdc++
 



The changed file is attached if you don't want to edit it yourself. You can see an arduino platform.txt example in "ArduinoIDE_Folder\hardware\arduino\avr"

The compiler statement in the platform.txt is missing the standard ARDUINO define of the version. If the version is less than 100 it signifies an old version of the arduino ide that uses wprogram.h instead of the arduino.h header. You will find the debugger code works the same way as many arduino libraries and project examples. (Actually you will find the author of the platform.txt has started to define the ARDUINO variable but has not used it)

The following should be added to compiler "compiler.cpp.flags=" in platform.txt

Code
Select All
-DARDUINO=10800 



The next release of visual micro contains automatic workarounds for both the issues described here so if you don't want to mess around you can wait for the next release. Due over the next couple of days I hope)

http://www.visualmicro.com/public_html/yabbfiles/Attachments/platform_007.txt
« Last Edit: Mar 31st, 2017 at 7:15pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Arduino for PSoC support issue
Reply #4 - Apr 1st, 2017 at 1:30pm
Print Post  
Bingo! It works. Even step debug.

Thanks a lot, Tim.
« Last Edit: Apr 1st, 2017 at 1:35pm by Kabron »  
Back to top
 
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Arduino for PSoC support issue
Reply #5 - Jun 26th, 2017 at 3:39pm
Print Post  
Tim, would you be kind to explain what program produced the === marked === output?

Using com port sniffer I see that after this marked action, the port is no more available to sniffer, but the programming procedure continues with avrdude. So, this magic app makes some preliminary setup for usb serial and then pass control to avrdude. Without it I could not reproduce the programming from the command line.

Code
Select All
Program Test size: 62 736 bytes (used 25% of a 256 000 byte maximum) (1.40 secs)

=================================
Uploading 'Test' to 'PSoC Dev Board' using 'COM10'
Uploader started for board PSoC Dev Board
Upload method will be: bootloader
Uploading via Bootloader
PORTS {COM2,COM1,COM10} / {COM2,COM1,COM10} => {}
PORTS {COM2,COM1,COM10} / {COM2,COM1} => {}
PORTS {COM2,COM1} / {COM2,COM1} => {}
PORTS {COM2,COM1} / {COM2,COM1} => {}
PORTS {COM2,COM1} / {COM2,COM1} => {}
PORTS {COM2,COM1} / {COM2,COM1,COM10} => {COM10}
=================================

c:\Arduino\hardware\tools\avr\bin\avrdude -V -ppsoc -C c:\Arduino\hardware\SparkFun/psoc/AVRDUD~1.CON -v -c avr109 -PCOM10 -D .ino.hex:i" 

« Last Edit: Jun 26th, 2017 at 3:50pm by Kabron »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino for PSoC support issue
Reply #6 - Jun 26th, 2017 at 4:02pm
Print Post  
Hi,

Visual Micro does that.

If a board is of type usb/leonardo then a special upload method is required. 

This involves connecting to the board at 1200 baud. In Arduino speak it's called "touching" the board. 

1200 baud causes the board to reboot into programming mode but on a different COM port. The port will usually be the same so you can fudge it once you know the port. 

Visual Micro gets a list of ports prior to the touch then waits for a few secs to see if a new port is found. If not then it should try to use the initial port you selection for the upload. This also caters for boards that are already in programming mode when the upload is started.

Click the reset on the board then look at the com port list in visual micro or device manager. Some boards always boot onto the programming port and wait a couple of secs before booting onto the usb port used for running code.
  
Back to top
WWW  
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Arduino for PSoC support issue
Reply #7 - Jun 27th, 2017 at 6:29am
Print Post  
Thanks a lot Tim.
I discovered that similar secuence used also by Arduino IDE.
What exact exe does port speed switching/discovering?
I need it to test my custom programmer from CLI.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino for PSoC support issue
Reply #8 - Jun 27th, 2017 at 10:55am
Print Post  
Yes it's all part of the published Arduino standard. You need to look at the Arduino CLI. Your question is unrelated to Visual Micro.
« Last Edit: Jun 27th, 2017 at 10:56am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Arduino for PSoC support issue
Reply #9 - Jun 27th, 2017 at 11:13am
Print Post  
Well, I found that if I launch any terminal app @1200 twice, disconnect and then run avrdude it works.
Enough for me for the beginning.
Thanks again.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino for PSoC support issue
Reply #10 - Jun 27th, 2017 at 11:20am
Print Post  
Yes, sorry that wasn't clear.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint