cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox Blog

Employee

Re-Targeting My ModusToolbox 2.0 Project

Last time out we got hello world running on the PROTO-062-4343W kit. That was a lot of fun for me… because I have that kit! Actually, I have about 20 of them because they arrived too late for the training event last week. But most of you don’t have 20 kits so, today, I am going to show you how to re-target an application to another kit.

All ModusToolbox applications have a BSP. It is the thing that defines the PSoC device, the memory layout, the connection to the Wi-Fi device over SDIO, the CapSense buttons and sliders, the I2C and UART peripherals, and the mechanical buttons and LEDs. We give these things standard names, like CYBSP_USER_LED, so that applications using those names can run on just about any kit even if the physical pins connected to the LED are different. So, to re-target our application we only have to do two things; add a new BSP to the project and tell the build tools to use it instead of the original BSP. Some examples actually include more than one BSP, for convenience, so you can often skip the first step!

I’ve been writing about CY8CPROTO-063-BLE kit recently (github.com/cypresssemiconductorco/TARGET_CY8CPROTO-063-BLE) so let’s switch our program to that one. You can read about the BSP on the GitHub site or you can just get on with it and download the thing (as you can tell, I’m a type-first, read-later guy). Just jump into the libs folder and clone the BSP.

yfs@YFS-T550 ~/MyFirstProject/mtb-example-psoc6-hello-world

$ cd libs

yfs@YFS-T550 ~/MyFirstProject/mtb-example-psoc6-hello-world/libs

$ git clone https://github.com/cypresssemiconductorco/TARGET_CY8CPROTO-063-BLE

Cloning into 'TARGET_CY8CPROTO-063-BLE'...

remote: Enumerating objects: 156, done.

remote: Counting objects: 100% (156/156), done.

remote: Compressing objects: 100% (106/106), done.

Receiving objectsremote: Total 156 (delta 43), reused 153 (delta 43), pack-reused 0:   % (85/

Receiving objects: 100% (156/156), 391.77 KiB | 1.42 MiB/s, done.

Resolving deltas: 100% (43/43), done.

Checking out files: 100% (135/135), done.

yfs@YFS-T550 ~/MyFirstProject/mtb-example-psoc6-hello-world/libs

$ ls -la

total 34

drwxr-xr-x 1 yfs 1049089  0 Nov 4 09:24 .

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:24 ..

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:12 capsense

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:12 core-lib

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:12 psoc6cm0p

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:13 psoc6hal

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:13 psoc6make

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:14 psoc6pdl

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:12 retarget-io

-rw-r--r-- 1 yfs 1049089 67 Nov  1 15:40 retarget-io.lib

drwxr-xr-x 1 yfs 1049089  0 Nov 1 16:12 TARGET_CY8CPROTO-062-4343W

-rw-r--r-- 1 yfs 1049089 82 Nov  1 15:40 TARGET_CY8CPROTO-062-4343W.lib

drwxr-xr-x 1 yfs 1049089  0 Nov 4 09:24 TARGET_CY8CPROTO-063-BLE

As you can see, you have added a new TARGET folder. Great, now let’s build for it. I can almost feel you gearing up for a stream of edit-this and move-that with a little bit of delete-the-other and a frustrating time. Not exactly, just add the name of the target to the build command.

yfs@YFS-T550 ~/MyFirstProject/mtb-example-psoc6-hello-world/libs

$ cd ..

yfs@YFS-T550 ~/MyFirstProject/mtb-example-psoc6-hello-world

$ make build TARGET=CY8CPROTO-063-BLE

Tools Directory: C:/Users/yfs/ModusToolbox/tools_2.0

Initializing build: mtb-example-psoc6-hello-world Debug CY8CPROTO-063-BLE GCC_ARM

    Stale device files detected. Running device configurator to regenerate files...

Auto-discovery in progress...

-> Found 158 .c file(s)

-> Found 36 .S file(s)

-> Found 18 .s file(s)

-> Found 0 .cpp file(s)

-> Found 0 .o file(s)

-> Found 4 .a file(s)

-> Found 377 .h file(s)

-> Found 0 .hpp file(s)

-> Found 0 resource file(s)

Applying filters...

Auto-discovery complete

==============================================================================

= Building application =

==============================================================================

Building 142 file(s)

    Compiling app file startup_psoc6_01_cm4.S

    Compiling app file cy_syslib_gcc.S

    Compiling app file cycfg.c

    Compiling app file cycfg_clocks.c

    Compiling app file cycfg_peripherals.c

    Compiling app file cycfg_pins.c

    Compiling app file cycfg_routing.c

    Compiling app file cycfg_system.c

    Compiling app file cybsp.c

    Compiling app file system_psoc6_cm4.c

    Compiling app file cy_capsense_centroid.c

    Compiling app file cy_capsense_control.c

    Compiling app file cy_capsense_csd.c

    Compiling app file cy_capsense_csx.c

    Compiling app file cy_capsense_filter.c

    Compiling app file cy_capsense_processing.c

    Compiling app file cy_capsense_sensing.c

    Compiling app file cy_capsense_structure.c

    Compiling app file cy_capsense_tuner.c

    Compiling app file psoc6_01_cm0p_sleep.c

    Compiling app file psoc6_02_cm0p_sleep.c

    Compiling app file psoc6_03_cm0p_sleep.c

    Compiling app file cyhal_adc.c

    Compiling app file cyhal_analog_common.c

    Compiling app file cyhal_crc.c

    Compiling app file cyhal_crypto_common.c

    Compiling app file cyhal_dac.c

    Compiling app file cyhal_flash.c

    Compiling app file cyhal_gpio.c

    Compiling app file cyhal_hwmgr.c

    Compiling app file cyhal_i2c.c

    Compiling app file cyhal_interconnect.c

    Compiling app file cyhal_lptimer.c

    Compiling app file cyhal_not_implemented.c

    Compiling app file cyhal_pwm.c

    Compiling app file cyhal_qspi.c

    Compiling app file cyhal_rtc.c

    Compiling app file cyhal_scb_common.c

    Compiling app file cyhal_sdhc.c

    Compiling app file cyhal_spi.c

    Compiling app file cyhal_system.c

    Compiling app file cyhal_tcpwm_common.c

    Compiling app file cyhal_timer.c

    Compiling app file cyhal_trng.c

    Compiling app file cyhal_uart.c

    Compiling app file cyhal_udb_sdio.c

    Compiling app file cyhal_usb_dev.c

    Compiling app file cyhal_utils.c

    Compiling app file cyhal_wdt.c

    Compiling app file cyhal_psoc6_01_104_m_csp_ble.c

    Compiling app file cyhal_psoc6_01_104_m_csp_ble_usb.c

    Compiling app file cyhal_psoc6_01_116_bga_ble.c

    Compiling app file cyhal_psoc6_01_116_bga_usb.c

    Compiling app file cyhal_psoc6_01_124_bga.c

    Compiling app file cyhal_psoc6_01_124_bga_sip.c

    Compiling app file cyhal_psoc6_01_43_smt.c

    Compiling app file cyhal_psoc6_01_68_qfn_ble.c

    Compiling app file cyhal_psoc6_01_80_wlcsp.c

    Compiling app file cyhal_psoc6_02_100_wlcsp.c

    Compiling app file cyhal_psoc6_02_124_bga.c

    Compiling app file cyhal_psoc6_02_128_tqfp.c

    Compiling app file cyhal_psoc6_02_68_qfn.c

    Compiling app file cyhal_psoc6_03_100_tqfp.c

    Compiling app file cyhal_psoc6_03_49_wlcsp.c

    Compiling app file cyhal_psoc6_03_68_qfn.c

    Compiling app file cy_ble_clk.c

    Compiling app file cy_canfd.c

    Compiling app file cy_crypto.c

    Compiling app file cy_crypto_core_aes_v1.c

    Compiling app file cy_crypto_core_aes_v2.c

    Compiling app file cy_crypto_core_cmac_v1.c

    Compiling app file cy_crypto_core_cmac_v2.c

    Compiling app file cy_crypto_core_crc_v1.c

    Compiling app file cy_crypto_core_crc_v2.c

    Compiling app file cy_crypto_core_des_v1.c

    Compiling app file cy_crypto_core_des_v2.c

    Compiling app file cy_crypto_core_ecc_domain_params.c

    Compiling app file cy_crypto_core_ecc_ecdsa.c

    Compiling app file cy_crypto_core_ecc_key_gen.c

    Compiling app file cy_crypto_core_ecc_nist_p.c

    Compiling app file cy_crypto_core_hmac_v1.c

    Compiling app file cy_crypto_core_hmac_v2.c

    Compiling app file cy_crypto_core_hw.c

    Compiling app file cy_crypto_core_hw_v1.c

    Compiling app file cy_crypto_core_mem_v1.c

    Compiling app file cy_crypto_core_mem_v2.c

    Compiling app file cy_crypto_core_prng_v1.c

    Compiling app file cy_crypto_core_prng_v2.c

    Compiling app file cy_crypto_core_rsa.c

    Compiling app file cy_crypto_core_sha_v1.c

    Compiling app file cy_crypto_core_sha_v2.c

    Compiling app file cy_crypto_core_trng_v1.c

    Compiling app file cy_crypto_core_trng_v2.c

    Compiling app file cy_crypto_core_vu.c

    Compiling app file cy_crypto_server.c

    Compiling app file cy_csd.c

    Compiling app file cy_ctb.c

    Compiling app file cy_ctdac.c

    Compiling app file cy_device.c

    Compiling app file cy_dma.c

    Compiling app file cy_dmac.c

    Compiling app file cy_efuse.c

    Compiling app file cy_flash.c

    Compiling app file cy_gpio.c

    Compiling app file cy_i2s.c

    Compiling app file cy_ipc_drv.c

    Compiling app file cy_ipc_pipe.c

    Compiling app file cy_ipc_sema.c

    Compiling app file cy_lpcomp.c

    Compiling app file cy_lvd.c

    Compiling app file cy_mcwdt.c

    Compiling app file cy_pdm_pcm.c

    Compiling app file cy_profile.c

    Compiling app file cy_prot.c

    Compiling app file cy_rtc.c

    Compiling app file cy_sar.c

    Compiling app file cy_scb_common.c

    Compiling app file cy_scb_ezi2c.c

    Compiling app file cy_scb_i2c.c

    Compiling app file cy_scb_spi.c

    Compiling app file cy_scb_uart.c

    Compiling app file cy_sd_host.c

    Compiling app file cy_seglcd.c

    Compiling app file cy_smartio.c

    Compiling app file cy_smif.c

    Compiling app file cy_smif_memslot.c

    Compiling app file cy_sysanalog.c

    Compiling app file cy_sysclk.c

    Compiling app file cy_sysint.c

    Compiling app file cy_syslib.c

    Compiling app file cy_syspm.c

    Compiling app file cy_systick.c

    Compiling app file cy_tcpwm_counter.c

    Compiling app file cy_tcpwm_pwm.c

    Compiling app file cy_tcpwm_quaddec.c

    Compiling app file cy_trigmux.c

    Compiling app file cy_usbfs_dev_drv.c

    Compiling app file cy_usbfs_dev_drv_io.c

    Compiling app file cy_usbfs_dev_drv_io_dma.c

    Compiling app file cy_wdt.c

    Compiling app file cy_retarget_io.c

    Compiling app file main.c

    Linking output file mtb-example-psoc6-hello-world.elf

==============================================================================

= Build complete =

==============================================================================

Calculating memory consumption: CYBLE-416045-02 GCC_ARM -Og

   --------------------------------------------------

  | Section Name         |  Address |  Size     |

--------------------------------------------------

  | .cy_m0p_image        |  0x10000000 |  5328     |

  | .text                |  0x10002000 |  36180    |

  | .ARM.exidx           |  0x1000ad54 |  8        |

  | .copy.table          |  0x1000ad5c |  24       |

  | .zero.table          |  0x1000ad74 |  8        |

  | .data                |  0x0800228c |  1892     |

  | .cy_sharedmem        |  0x080029f0 |  12       |

  | .noinit              |  0x08002a00 |  148      |

  | .bss                 |  0x08002a94 |  976      |

  | .heap                |  0x08002e68 |  276888   |

--------------------------------------------------

  Total Internal Flash (Available) 1048576

  Total Internal Flash (Utilized)           46324

  Total Internal SRAM (Available) 292864

  Total Internal SRAM (Utilized) 279916

Now you can just run ”make qprogram” and hello world will run just the same way as it did on the original kit. That was cool, let’s do it again!

When you type as haphazardly as I do, that extra text at the end of the command is just asking for a typo. So I need a more permanent solution. It’s easy to do… just open the Makefile in a text editor, look for the line “TARGET=CY8CPROTO-062-4343W” and change the name of the board to CY8CPROTO-063-BLE, like this.

################################################################################

# Basic Configuration

################################################################################

# Target board/hardware

# TARGET=CY8CPROTO-062-4343W

TARGET=CY8CPROTO-063-BLE

Now you can build and program your kit in one step with the almost-impossible-to-mistype command “make program”. You’ll never guess how to go back to the other kit!

OK, that’s enough typing for me. Next time I’ll show off the new GUI tools we have created to automate all this make shenanigans.

0 Likes
19 Comments
New Contributor II

My CYW943012P6EVB-01 kit is available in WICED but not in ModusToolbox. How do I make it available in ModusToolbox?

0 Likes
Employee

That kit is very focused on Wi-Fi applications and that is not (yet) supported in the flow I have described. We currently support Wi-Fi in the Mbed and Amazon FreeRTOS ecosystems and that kit is supported in Mbed. Unfortunately you cannot create a project in Modus Shell or ModusToolbox IDE for that kit today.

Honored Contributor

Mark,

I downloaded the RTC_Basics example for the CY8CPROTO-063-BLE and compiled and programmed the kit successfully.

I then modified the MakeFile to

#TARGET=CY8CPROTO-063-BLE

TARGET=CY8CPROTO-062-4343W

I then rebuilt the project WITH NO REPORTED ERRORS.  However when I tried to program the CY8CPROTO-062-4343W board, it complained:

** Programming Started **

auto erase enabled

Info : Flash write discontinued at 0x100014d0, next section at 0x10002000

Info : Padding image section 0 at 0x100014d0 with 304 bytes (bank write end alignment)

Error: Timeout acquiring IPC structure

Error: SROM API execution failed. Status: 0x1C000100

Error: failed erasing sectors 0 to 10

** Program operation failed **

srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : SWD DPIDR 0x6ba02477

Info : psoc6.cpu.cm0: external reset detected

shutdown command invoked

I'm not sure what I did wrong.  I thought based on your example above, that retargeting the device as I did was sufficient.

Len

0 Likes
Employee

Hello!

It looks like you have done everything right. I think the problem is not with the project at all. I suspect your new kit is not in the correct programming mode. Press the oval button next to the USB connector. Count to 15 so that any drivers get installed. Try to program the kit again. Let us know if this works!

Mark.

0 Likes
Honored Contributor

Mark,

Thank you for the reply.

I pressed the "Mode" oval button for 18 seconds.  When I released it, the KitProg3 was in "mBed Serial Port (109)" and the "Status" LED is OFF.

I get the following response when trying to Program:

Open On-Chip Debugger 0.10.0+dev-2.2.0.249 (2019-09-10-10:57)

Licensed under GNU GPL v2

For bug reports, read

    http://openocd.org/doc/doxygen/bugs.html

adapter speed: 1500 kHz

adapter speed: 1000 kHz

** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable

cortex_m reset_config sysresetreq

cortex_m reset_config vectreset

ocd_gdb_restart

Warn : SFlash programming allowed for regions: USER, TOC, KEY

Info : CMSIS-DAP: SWD  Supported

Info : CMSIS-DAP: FW Version = 1.10

Info : CMSIS-DAP: Interface Initialised (SWD)

Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1

Info : CMSIS-DAP: Interface ready

Error: *******************************************************************************************

Error: * KitProg firmware is out of date, please update to the latest version using fw-loader at *

Error: * ModusToolbox/tools/fw-loader                                                            *

Error: *******************************************************************************************

Error: No Valid JTAG Interface Configured.

When I press the "Mode" button for three seconds, ("Status" LED solid ON), I'm back in KitProg3 mode "KitProg3 USB-UART (COM106)".  Same error as before.

I suppose there is some info I left out originally.

  1. I first imported the RTC_Basics as a CY8CPROTO-062-4343W target.  It built correctly and programmed into the target with no issue.
  2. I then imported RTC_Basics again but this time with the CY8CPROTO-063-BLE as a target.  It loaded a new project into the workspace as "RTC_Basics_1".  It built correctly and programmed into the target with no issue.
  3. I modified the Makefile on this second version of the project to retarget it to the CY8CPROTO-062-4343W.  It built without errors but when it came to programming the CY8CPROTO-062-4343W target, I received the errors I reported. 

It appears some information is out-of-sync or missing.  Hence my post.

Overall, I was trying to have ONE project with the ability for programming multiple targets.  This way it can share much of the same code.

Len

0 Likes
Employee

Yes, this is a different issue. The programming is not failing because of the mode of the KitProg firmware but because the physical target is not the same as the project target. It is definitely possible to build the program for different BSPs and, you are correct, the way to do that is by editing the Makefile to change the TARGET rule.

The best way to do this is to create an RTC_Basics project for the 062-4343W board. Build and program that to check that things are good. You will need to make sure the KitProg is back in the right mode of course! Then open the Library Manager (there is a link in the Quick Panel and it is in the project menu, or you can type Control-8) and look at the BSPs. The 063-BLE will be listed but not checked. Check it and apply the changes. At this point you have both BSPs in your project. Open the Makefile and change the TARGET=CY8CPROTO-063-BLE. Swap the board and build and program the new one.

We kinda designed the build recipe specifically to make this work - so please let us know how you get on!

Honored Contributor

Mark,

The best way to do this is to create an RTC_Basics project for the 062-4343W board. Build and program that to check that things are good. You will need to make sure the KitProg is back in the right mode of course!

Done.  I can successfully build the project using the CY8CPROTO-062-4343W as target.

Then open the Library Manager (there is a link in the Quick Panel and it is in the project menu, or you can type Control-8) and look at the BSPs. The 063-BLE will be listed but not checked. Check it and apply the changes. At this point you have both BSPs in your project.

Done. See pic.

pastedImage_4.png

Open the Makefile and change the TARGET=CY8CPROTO-063-BLE.

Done.  See pic.

pastedImage_7.png

Swap the board and build and program the new one.

Done.  However, I get the following error.

15:54:15 **** Incremental Build of configuration Debug for project RTC_Basics ****

"C:\\Users\\lpoma\\ModusToolbox\\tools_2.0\\modus-shell\\bin\\make" CY_MAKE_IDE=eclipse CY_IDE_TOOLS_DIR=C:/Users/lpoma/ModusToolbox/tools_2.0 -j8 all

Tools Directory: C:/Users/lpoma/ModusToolbox/tools_2.0

Initializing build: mtb-example-psoc6-rtc-basics Debug CY8CPROTO-063-BLE GCC_ARM

Available target(s): CY8CPROTO-062-4343W

libs/psoc6make/make/core/target.mk:71: *** Target "CY8CPROTO-063-BLE" not found.  Stop.

"C:/Users/lpoma/ModusToolbox/tools_2.0/modus-shell/bin/make CY_MAKE_IDE=eclipse CY_IDE_TOOLS_DIR=C:/Users/lpoma/ModusToolbox/tools_2.0 -j8 all" terminated with exit code 2. Build might be incomplete.

15:54:19 Build Failed. 1 errors, 0 warnings. (took 4s.337ms)

There must still be a step missing in the process.

Here's a snippet of my libs directory in the project.

pastedImage_10.png

Len

0 Likes
Employee

I think the problem is that the Library Manager lets you make changes and not save them. This one has bitten me already! Go back to the manager, check that the BSP is checked still, and press the Apply button. It will check the .lib file and download the TARGET folder. Again, please let us know how you get on. I think you have already helped us identify a usability issue here!

Honored Contributor

Mark,

I went back into the Library manager.  The CY8CPROTO-063-BLE had a check on it.

I proceeded to uncheck it and apply changes.

After this completed, i checked CY8CPROTO-063-BLE again and applied changes.

pastedImage_0.png

I got the following Lib Manager output:

"C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-063-BLE.lib" is added or updated

Running "make getlibs"...

Tools Directory: C:/Users/lpoma/ModusToolbox/tools_2.0

Initializing import: mtb-example-psoc6-rtc-basics

==============================================================================

= Importing libraries =

==============================================================================

Git is git version 2.17.0, found at /usr/bin/git

Searching application directories...

Application directories search complete.

Searching libs directory...

Found 9 file(s)

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-063-BLE.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/retarget-io.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/capsense.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/core-lib.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6cm0p.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6hal.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6make.lib

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6pdl.lib

Libraries were processed. Re-evaluating libs directory...

Found 14 file(s)

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-063-BLE/libs/core-lib.lib

  Library "core-lib.lib" was already processed at C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/core-lib.lib.

  Skipping current reference...

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-063-BLE/libs/psoc6cm0p.lib

  Library "psoc6cm0p.lib" was already processed at C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6cm0p.lib.

  Skipping current reference...

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-063-BLE/libs/psoc6hal.lib

  Library "psoc6hal.lib" was already processed at C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6hal.lib.

  Skipping current reference...

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-063-BLE/libs/psoc6make.lib

  Library "psoc6make.lib" was already processed at C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6make.lib.

  Skipping current reference...

  Processing file C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-063-BLE/libs/psoc6pdl.lib

  Library "psoc6pdl.lib" was already processed at C:/Users/lpoma/mtw/RTC_Basics/libs/TARGET_CY8CPROTO-062-4343W/libs/psoc6pdl.lib.

  Skipping current reference...

Libraries were processed. Re-evaluating libs directory...

Found 14 file(s)

libs directory search complete.

==============================================================================

= Import complete =

==============================================================================

Successfully updated the project.

My libs folder in the project now has the new target.

pastedImage_1.png

A build is now successful.

HOWEVER ...

A programming attempt of the CY8CPROTO-063-BLE is not.

I get the following output from the programming stage:

Open On-Chip Debugger 0.10.0+dev-2.2.0.249 (2019-09-10-10:57)

Licensed under GNU GPL v2

For bug reports, read

    http://openocd.org/doc/doxygen/bugs.html

adapter speed: 1500 kHz

adapter speed: 1000 kHz

** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable

cortex_m reset_config sysresetreq

cortex_m reset_config vectreset

Info : Using CMSIS loader 'CY8C6xxA_SMIF' for bank 'psoc6_smif0_cm0' (footprint 6105 bytes)

ocd_gdb_restart

Warn : SFlash programming allowed for regions: USER, TOC, KEY

Info : CMSIS-DAP: SWD  Supported

Info : CMSIS-DAP: FW Version = 2.0.0

Info : CMSIS-DAP: Interface Initialised (SWD)

Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1

Info : CMSIS-DAP: Interface ready

Info : VTarget = 3.342 V

Info : kitprog3: acquiring PSoC device...

Info : clock speed 1000 kHz

Info : SWD DPIDR 0x6ba02477

Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints

Info : psoc6.cpu.cm0: external reset detected

***************************************

** Silicon: 0xE2F0, Family: 0x100, Rev.: 0x23 (B2)

** Detected Device: CYBLE-416045-02

** Detected Main Flash size, kb: 1024

** Flash Boot version 1.20.1.42

** Chip Protection: UNKNOWN

***************************************

Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints

Info : psoc6.cpu.cm4: external reset detected

Info : Listening on port 3333 for gdb connections

Info : Listening on port 3334 for gdb connections

Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset any peripherals or configure hardware srst support.

Info : kitprog3: acquiring PSoC device...

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x00001f34 msp: 0x080477a8

** Device acquired successfully

** psoc6.cpu.cm4: Ran after reset and before halt...

target halted due to debug-request, current mode: Thread

xPSR: 0x61000000 pc: 0x1600400c msp: 00000000

** Programming Started **

auto erase enabled

Info : Flash write discontinued at 0x100013cc, next section at 0x10002000

Info : Padding image section 0 at 0x100013cc with 52 bytes (bank write end alignment)

Error: Timeout acquiring IPC structure

Error: SROM API execution failed. Status: 0x1C000100

Error: failed erasing sectors 0 to 9

** Program operation failed **

srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : SWD DPIDR 0x6ba02477

Info : psoc6.cpu.cm0: external reset detected

shutdown command invoked

It would appear that the build phases have been rectified but the programming phase is still out-of-sync with the Target.

Len

0 Likes
Employee

I think the build is good. Pretty sure we have a board problem. Could you try creating a new Hello World project from scratch for that kit and see if you build and program it? If not, let's make sure we have the right firmware and make it behave!

Go to ~/ModusToolbox/tools_2.0/modus-shell.

Run cygwin.bat to open a new shell window.

cd ~/ModusToolbox/tools_2.0/fw-loader/bin

./fw-loader.exe --device-list

     It this returns "No connected devices" then press the KitProg mode button (just briefly, do not hold it down).

     Run the command again. It should return something like the following.

          Connected supported devices:

             1: KitProg3 CMSIS-DAP BULK-0811116C03227400     FW Version 1.13.322

Re-program the KitProg firmware with ./fw-loader.exe --update-kp3

It should print a lot of text that ends:

          Info: Upgrade completed

          Info: Connected - KitProg3 CMSIS-DAP BULK-0811116C03227400

          FW update completed successfully

          Info: Disconnected - KitProg Bootloader-0811116C03227400

Finally, set the mode to CMSIS-DAP (bulk).

          ./fw-loader.exe --mode kp3-bulk

With any luck this will have your kit ready for programming.

0 Likes
Honored Contributor

Mark,

I've tried your suggestions.

Could you try creating a new Hello World project from scratch for that kit and see if you build and program it?

Done.  I imported "Hello_World" for the CY8CPROTO-063-BLE target.  It built and programmed.  No issue.

Go to ~/ModusToolbox/tools_2.0/modus-shell.

Run cygwin.bat to open a new shell window.

cd ~/ModusToolbox/tools_2.0/fw-loader/bin

./fw-loader.exe --device-list

I ran the fw-loader tool on the CY8CPROTO-063-BLE and received the following info:

C:\Users\lpoma\ModusToolbox\tools_2.0\fw-loader\bin>fw-loader.exe --device-list

Cypress Firmware Updater, Version: 2.2.10.261

(C) Copyright 2018-2019 by Cypress Semiconductor

All Rights Reserved

Info: Start API initialization

Info: Connected - KitProg3 CMSIS-DAP BULK-1223146503068400

Info: Hardware initialization complete (748 ms)

Connected supported devices:

        1: KitProg3 CMSIS-DAP BULK-1223146503068400     FW Version 1.1.158

Re-program the KitProg firmware with ./fw-loader.exe --update-kp3

After an update I received:

C:\Users\lpoma\ModusToolbox\tools_2.0\fw-loader\bin>fw-loader.exe --update-kp3

Cypress Firmware Updater, Version: 2.2.10.261

(C) Copyright 2018-2019 by Cypress Semiconductor

All Rights Reserved

Info: Start API initialization

Info: Connected - KitProg3 CMSIS-DAP BULK-1223146503068400

Info: Hardware initialization complete (1014 ms)

Device 'KitProg3 CMSIS-DAP BULK-1223146503068400' opened successfully

Info: Kit FW is 'KitProg3' ver. 1.01 b158.  Upgrade file is 'KitProg3' ver. 1.13 b322.

Info: Disconnected - KitProg3 CMSIS-DAP BULK-1223146503068400

Info: Connected - KitProg Bootloader-1223146503068400

Info: Bootloader Version: Major 1, Minor 1, Build 40

Info: FW Upgrade to version: 1.13 b322

Info: Bootloading of KitProg FW...

Info: Verifying of KitProg FW...

Info: Bootloading of DAPLink...

Info: Verifying of DAPLink...

Info: Upgrade completed

Info: Connected - KitProg3 CMSIS-DAP BULK-1223146503068400

FW update completed successfully

Info: Disconnected - KitProg Bootloader-1223146503068400

Finally, set the mode to CMSIS-DAP (bulk).

          ./fw-loader.exe --mode kp3-bulk

Output:

C:\Users\lpoma\ModusToolbox\tools_2.0\fw-loader\bin>fw-loader.exe --mode kp3-bulk

Cypress Firmware Updater, Version: 2.2.10.261

(C) Copyright 2018-2019 by Cypress Semiconductor

All Rights Reserved

Info: Start API initialization

Info: Connected - KitProg3 CMSIS-DAP BULK-1223146503068400

Info: Hardware initialization complete (1060 ms)

Mode switch completed successfully

I then tried to program the RTC_Basics project with the targeting to the CY8CPROTO-063-BLE.  Still no luck.

Here's the output of the programming phase:

Open On-Chip Debugger 0.10.0+dev-2.2.0.249 (2019-09-10-10:57)

Licensed under GNU GPL v2

For bug reports, read

    http://openocd.org/doc/doxygen/bugs.html

adapter speed: 1500 kHz

adapter speed: 1000 kHz

** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable

cortex_m reset_config sysresetreq

cortex_m reset_config vectreset

Info : Using CMSIS loader 'CY8C6xxA_SMIF' for bank 'psoc6_smif0_cm0' (footprint 6105 bytes)

ocd_gdb_restart

Warn : SFlash programming allowed for regions: USER, TOC, KEY

Info : CMSIS-DAP: SWD  Supported

Info : CMSIS-DAP: FW Version = 2.0.0

Info : CMSIS-DAP: Interface Initialised (SWD)

Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1

Info : CMSIS-DAP: Interface ready

Info : VTarget = 3.337 V

Info : kitprog3: acquiring PSoC device...

Info : clock speed 1000 kHz

Info : SWD DPIDR 0x6ba02477

Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints

Info : psoc6.cpu.cm0: external reset detected

***************************************

** Silicon: 0xE2F0, Family: 0x100, Rev.: 0x23 (B2)

** Detected Device: CYBLE-416045-02

** Detected Main Flash size, kb: 1024

** Flash Boot version 1.20.1.42

** Chip Protection: UNKNOWN

***************************************

Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints

Info : psoc6.cpu.cm4: external reset detected

Info : Listening on port 3333 for gdb connections

Info : Listening on port 3334 for gdb connections

Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset any peripherals or configure hardware srst support.

Info : kitprog3: acquiring PSoC device...

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x00001f34 msp: 0x080477a8

** Device acquired successfully

** psoc6.cpu.cm4: Ran after reset and before halt...

target halted due to debug-request, current mode: Thread

xPSR: 0x61000000 pc: 0x1600400c msp: 00000000

** Programming Started **

auto erase enabled

Info : Flash write discontinued at 0x100013cc, next section at 0x10002000

Info : Padding image section 0 at 0x100013cc with 52 bytes (bank write end alignment)

Error: Timeout acquiring IPC structure

Error: SROM API execution failed. Status: 0x1C000100

Error: failed erasing sectors 0 to 9

** Program operation failed **

srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : SWD DPIDR 0x6ba02477

Info : psoc6.cpu.cm0: external reset detected

shutdown command invoked

Would it be beneficial to send you a copy of the project as it appears in my computer?

Len

0 Likes
Employee

I had to go into the office to find one of the 063 kits but I can now replicate your issue. I have not yet root-caused it but I am pretty sure that the Eclipse launch configurations are not getting updated for the new kit. If I am right the program is being built correctly but is not programmable from the links in the IDE Quick Panel. There are three workaround I can think of...

  • Program from the command line ("make program" in the project folder)
  • Use Cypress Programmer
  • Create your own Build Target in Eclipse
    • Right click on the project in the Project Explorer view
    • Go to Build Targets and select Create.
    • In the dialog write "program TARGET=CY8CPROTO-063-BLE".

               pastedImage_3.png

  • Press OK. this creates a new folder in the project - "Build Targets". In the image below I have actually created two targets. This means I can double-click to build and program for either target without the need to edit the Makefile (because the TARGET rule over-rides the Makefile setting).

               pastedImage_4.png

Sorry this has been a bit of a challenge for you. We appreciate you sticking with us - it has given us some good knowledge of the user experience and (I think) uncovered a defect in the RTC example. As usual, please let us know if this helps. We'll work on the actual fix, of course.

Honored Contributor

Mark,

Thank you for patience and thank you for your "above-and-beyond" ethic (going to work on a Sunday!).

Program from the command line ("make program" in the project folder)

I tried many different ways.  I'm not sure I got the command line right.  Therefore, no luck here.

Use Cypress Programmer

I pointed the Programmer to the correct build directory and found the .hex file.  However, it complained of a Hex File parsing issue.

Program Finished at 10:22:24 PM                                               |
                                                                              | FAILED! Hex File parsing failure. Unknown record type.
                                                                              | Unchecked sections will be skipped for Program operation
Device set to CYBLE-416045-02 at 10:22:24 PM                                  | 1048576  FLASH bytes
Device Family set to CY8C63xx at 10:22:24 PM                                  |
                                                                              | Automatically Detected Device: CYBLE-416045-02
                                                                              | Silicon: 0xE2F0, Family: 0x100, Rev.: 0x23 (*C)
                                                                              | SROM Firmware: 4.01, Flash Boot: 1.20.1.42 (*C)
                                                                              | Protection state: 0x02 (NORMAL), Life Cycle stage: 0x01 (NORMAL)
                                                                              | Hex File parsing failure. Unknown record type.
Program Requested at 10:22:24 PM                                              |

Successfully Connected to KitProg3 (CMSIS-DAP/BULK/1223146503068400) at 10:22:11 PM    | KitProg3. CMSIS-DAP Version 2.0.0. Firmware Version 1.13.322. Hardware Id 03.

Opening Port at 10:22:11 PM                                                   |

No luck here.

Create your own Build Target in Eclipse

I did as suggested and created a new build target.

That WORKED!  (jump up and down!)

Therefore, it might be best (for now) to replace the MakeFile retargeting to creating a specific Build Target instead.

Len

0 Likes
Honored Contributor

Mark,

In a related question.  You stated:

this creates a new folder in the project - "Build Targets". In the image below I have actually created two targets. This means I can double-click to build and program for either target without the need to edit the Makefile (because the TARGET rule over-rides the Makefile setting).

Is the rest of the Makefile used in the case of double-clicking on the selected Build Target?  Just the selected TARGET is replaced in the MakeFile?

Thanks again for your help.

Len

0 Likes
Employee

Yes, those Build Targets simply over-ride the TARGET rule in the Makefile. Everything else still comes from the Makefile, like the compiler choice and other configuration options.

Honored Contributor

To everyone monitoring this discussion,

I have originally imported 8 example projects for the CY8CPROTO-062-4343W in ModusToolbox 2.0.  I got them all built and working on this board.

Based on the conclusions of this discussion and Mark's helpful information, I'm going to summarize what I have found as useful in retargeting working projects to another target board.

  • Start with a working project developed for a specific target board (eq. CY8CPROTO-062-4343W, CYKIT-062-BLE, etc).
  • Connect the new target board into your host computer.
  • Open the Library Manager in the project.
  • Check select the desired board to which you wish to retarget.  Select Apply.  Answer OK when asked and then wait until ALL files are loaded into your lib directory.  Aborting out of Library Manager may not load all necessary files for the new target.

pastedImage_1.png

  • Select the project and right-mouse select the "Build Targets\Create...".pastedImage_4.png
  • In the "Create Build Target" window type the following into the "Target name:" field "program TARGET={target_name}" where {target_name} is the name of the new target board as listed in the Library Manager (eg. program TARGET=CY8CPROTO-063-BLE).  Select OK when done.

pastedImage_7.png

  • You should now see a new Build Target with a "program" designation.  You can double-click on the new target to start the rebuilding for that target and if no errors are found, it should reprogram the new target with the completed build.

pastedImage_10.png

Notes:

  1. If you are using your own working project on a new target, you can follow the steps listed above but you may have to make sure that the new target board has the same resources.  If not, you may have to make adjustments in the code.  Examples:  A successful build on a board with calls to Wifi resources will not work on a board without Wifi functions.  You may have to conditionally compile out the Wifi functions.  Other boards may have LEDs and other GPIO on other ports.  You may have to change your COMPONENT_BSP_DESIGN_MODUS directory files to remap the HW resources to the new target resources.
  2. The "program" keyword in a successful build process will attempt to build on the first KitProg3 found on the host computer.  Therefore if you have more than one KitProg3 connected, it may not find the desired target device and the programming phase errors out with a failed erase cycle.  I recommend only plugging one KitProg3 board at a time.

The above process starts with a working project using the original Target board.  I found it to be fairly quick to retarget if the new target can support the same HW resources.

Len

0 Likes
Employee

Hello!

I am sorry this is late - this has troubled/baffled me for a while and (I think) I finally know what is wrong here. Instead of editing the Makefile to change the target you need to set it in the library manager. Here is the GUI where you will see the "Active BSP" selection. I did not know that existed until this morning!

pastedImage_0.png

I tried it out it works just fine - unsurprisingly really, now that I am using the tool correctly - so there should be no need to create those build targets after all. Hope your work is progressing well.

Regards, Mark Saunders.

0 Likes
Honored Contributor

vMark,

I have successfully changed the target as you described above.  Note:  To do so, I did have to choose the desired BSP first (See pic below) then select "Apply" to load the needed libraries for the BSP.

pastedImage_1.png

Doing this, I can skip making Build Targets as indicated in previous posts.

Len

0 Likes
Employee

That's great news. Thank you for letting us know. Your feedback is definitely helping us to improve the tool. Hopefully we will have a more intuitive library manager interface in our next release, which should be early next year.

Mark.

0 Likes