cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox General

OkBa_4438736
New Contributor II

We have a project based on "BLE  Battery Level FreeRTOS" and we have migrated it from Modustoolbox 1.1 to MTB 2.1.

We have copyied the Device and Bluetooth Configurators and updated all personalities accordingly. Modified the the Library Manager also.

However when we build the application, we get lots of "symbol .. could not be resolved" errors.

screen1.jpg

I can see that all necessary libraries are there.

screen2.jpg

and if I want to include libraries manually from Properties->C/C++ Build->Settings, the Tool Settings tab is not there.

screen3.jpg

So the question is how can I check which libraries are included to build ?

Regards,

0 Likes
Reply
1 Solution
Rakshith
Moderator
Moderator

Hi OkBa_4438736​,

I have attached the ModusToolbox 2.1 project for your reference.

1. I started with the BLE_Battery_Level_FreeRTOS CE in MTB 2.1

2. Included all the libraries that are needed using the Library Manager

3. Copied the same design.modus file present in the MTB 1.1 project and replaced the existing design.modus file in the directory <MTB2.1_project_directory>\libs\TARGET_CY8CPROTO-063-BLE\COMPONENT_BSP_DESIGN_MODUS

4. Clicked on the Device Configurator tool in the Quick Panel in MTB 2.1, fixed the errors which appear due to the version mismatch and saved the file.

5. I replaced the design.cybt file present in the project with the design.cybt file that was in the MTB 2.1 project that you shared in your previous comment.

6. I then built the project. Two macros were not defined so I copied the macros from the cycfg_ble.h of MTB1.1 project and defined it in ble_task.h as shown -

pastedImage_1.png

7. After this I was able to build the project successfully.

I have not confirmed the functionality of the project. But you can start with this project. Please confirm that the project works as expected. If you find any issue with any of the component or if you are stuck in using the project please create a new thread and we will be happy to help you. You can refer to this KBA for steps to import the archive into your MTB 2.1 workspace - Sharing My Eclipse Project 

Adding to this, like I have told in my previous comment, we are working on a KBA explaining how to port the project from MTB 1.1 to MTB 2.1 in detail. Stay tuned for that.

Hope this helps,

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
Reply
21 Replies
Len_CONSULTRON
Honored Contributor

OkBa,

There have been cautions about moving MTB 1.1 projects over to MTB 2.0.  It appears in many cases the structures of the API calls changed even when using PDL peripherals.  Some of the API calls changed from PDL 2.1 to 3.0 to 3.10 to 3.40.

Therefore calls (variables and defines) made in MTB 1.1 are not always the same in MTB 2.0.

With cautious investigation, most times, the conversions can be made manually. 

I found this out especially when converting PSoC Creator projects to MTB.

If you still have MTB 1.1 installed, I recommend investigating the Symbols referred to in the error list under MTB 2.0 and find where they are sourced.   Find the equivalent in MTB 2.0 and hand-convert.

One potential way to hand-convert is to create an alias header file that makes Symbol reassignment.  This may not work under all conditions but it might be a start.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply
OkBa_4438736
New Contributor II

Hi LePo_1062026​,

Thanks for the answer. I am using the same PDL (3.10) version in both of MTB 1.1. and MTB 2.1.

When I investigate the Symbols referred to in the error list, I can see that the necessary files are already in the project in MTB 2.1.

For instance, an error says that it can not find ADC hardware symbol but the necessary device header file is already in the lib folder (psoc6hal). Another error says "fatal error: FreeRTOS.h: No such file or directory". This makes me think that there is something going wrong during the project build. Probably these libraries are not included into the build process.

PS: I am using default makefile without any change.

0 Likes
Reply
Len_CONSULTRON
Honored Contributor

OkBa,

I don't know about the reference to:

For instance, an error says that it can not find ADC hardware symbol ...

since the MTB doesn't have a TopDesign that PSoC Creator has.

Now about:

Another error says "fatal error: FreeRTOS.h: No such file or directory".

It appears from the directory list you supplied that the FreeRTOS files can been added to your BSP directory.

Now check the MakeFile.

Scroll down to the "COMPONENTS" line.

It should read:

COMPONENTS=EMWIN_OSNTS

The COMPONENTS line is to indicate to the build that you are using middleware components.

The EMWIN designates you are using emWin.

The OS indicates you are using an Operating System in this case the FreeRTOS.

The NTS indicates you are NOT using a Touch Screen.  Change to TS if you are.

Modify the COMPONENTS line and try it.  Hopefully this addresses the issue you are having.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply
OkBa_4438736
New Contributor II

Hi LePo,

Thanks for the tip about modifying the make file.

However, the trick did not work. Still I am getting FreeRTOS related errors.

rtos_error2.jpg

Regards,

0 Likes
Reply
Len_CONSULTRON
Honored Contributor

OkBa,

I'm stumped.

Are you willing to upload your MTB project to the forum?

Myself or someone else might spot the issue if we had your build.

Note:  This archive WILL BE large.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply
OkBa_4438736
New Contributor II

LePo_1062026

Here you can find the MTB project.

Regards,

0 Likes
Reply
Rakshith
Moderator
Moderator

Hi OkBa_4438736​,

I tried importing the project into ModusToolbox 2.1 and I was unable to achieve that. I think there was an issue during the importing of the libraries. Also, I do not seem to find all the files in the archive shared like wave.h, sound.h and kxtj3_1057.h.

Can you please share the working ModusToolbox 1.1 project and also the detailed steps describing the procedure followed to port the MTB 1.1 project to MTB 2.1 so that it will help us in debugging the issue?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
Reply
OkBa_4438736
New Contributor II

Hi RakshithM_16

Here you can see another export of my MTB 2.1 project. hopefully this time it will work.

Regards !

0 Likes
Reply
Len_CONSULTRON
Honored Contributor

Rakshith,

I was able to download the project and import the code in MTB 2.1.

I do get complaints about not finding header files such as "FreeRTOS.h"  that DO exist in the project.

Attached is a log of the Console output of the build attempt on this project.

Also attached is a log of the Console output of the build on a working FreeRTOS project.

I'm no expert but it appears from the logs of the console output and the other items mentioned below that OkBa's issue might be how the build is set up.

On OkBa's MTB Quick Panel another option appears that doesn't appear on my working project:  "Project Build Settings"

pastedImage_1.png

When I compare OkBa's project build properties to my working project properties I notice two more tabs on OkBa's.

pastedImage_2.png

Hopefully this might bring some clues.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply
OkBa_4438736
New Contributor II

LePo_1062026

The reason that I have more tabs in  the C/C++ Build > Settings is that I have selected " Generate Makefiles auttomatically" box in the C/C++ build >Builder Settings. with this way I wanted to see which files are included in the build process. But I could not see any path there.

Regards,

0 Likes
Reply
Rakshith
Moderator
Moderator

Hi OkBa_4438736, LePo_1062026​,

The build flow and the directory structure in MTB 1.1 and MTB 2.1 is different and you cannot directly import a MTB 1.1 project into MTB 2.1. We are working on a KBA explaining how to port the project from MTB 1.1 to MTB 2.1. Stay tuned for that.

The MTB 1.1 uses the subdir.mk in each directory to track all the files which is not found in the MTB 2.1 project. These subdir.mk files are unable to find the lib files that are getting generated.

So can you please share the working ModusToolbox 1.1 project? I will try porting the project to ModusToolbox 2.1 and share the project with you.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
OkBa_4438736
New Contributor II

Hi RakshithM_16

Here you can find the MTW 1.1 project.

0 Likes
Reply
Rakshith
Moderator
Moderator

Hi OkBa_4438736​,

I have attached the ModusToolbox 2.1 project for your reference.

1. I started with the BLE_Battery_Level_FreeRTOS CE in MTB 2.1

2. Included all the libraries that are needed using the Library Manager

3. Copied the same design.modus file present in the MTB 1.1 project and replaced the existing design.modus file in the directory <MTB2.1_project_directory>\libs\TARGET_CY8CPROTO-063-BLE\COMPONENT_BSP_DESIGN_MODUS

4. Clicked on the Device Configurator tool in the Quick Panel in MTB 2.1, fixed the errors which appear due to the version mismatch and saved the file.

5. I replaced the design.cybt file present in the project with the design.cybt file that was in the MTB 2.1 project that you shared in your previous comment.

6. I then built the project. Two macros were not defined so I copied the macros from the cycfg_ble.h of MTB1.1 project and defined it in ble_task.h as shown -

pastedImage_1.png

7. After this I was able to build the project successfully.

I have not confirmed the functionality of the project. But you can start with this project. Please confirm that the project works as expected. If you find any issue with any of the component or if you are stuck in using the project please create a new thread and we will be happy to help you. You can refer to this KBA for steps to import the archive into your MTB 2.1 workspace - Sharing My Eclipse Project 

Adding to this, like I have told in my previous comment, we are working on a KBA explaining how to port the project from MTB 1.1 to MTB 2.1 in detail. Stay tuned for that.

Hope this helps,

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
Reply
OkBa_4438736
New Contributor II

Hi RakshithM_16​,

Can you also explain how did you move the source code from MTB1.1 to MTB 2.1 ?

Seems like the replaced design.cybt file in the  MTB 2.1 is different than the one in MTB1.1.

Unfortunately, When I program my PSOC 6 device it us programmed successfully.

programm.jpg

However, nothing happens in terms of functionality (BLE unit on the chip is not powered, no print out), while it was working in MTB 1.1

Regards,

0 Likes
Reply
Rakshith
Moderator
Moderator

Hi OkBa_4438736​,

Can you also explain how did you move the source code from MTB1.1 to MTB 2.1 ?

According to my understanding, you are talking about the files in the source directory. To add files into the MTB 2.1 project you can just paste the file in the project directory. MTB 2.1 has autodiscovery and thus it automatically compiles all the files.

Seems like the replaced design.cybt file in the  MTB 2.1 is different than the one in MTB1.1.

Yes, like I said I used the design.cybt file that you shared with the MTB 2.1 project in your previous comment. Please change the BLE settings based on the requirements of the application. You can do this by clicking on the Bluetooth Configurator tool in the Quick Panel.

no print out

How are you observing the UART output? If you are using KitProg and Serial Terminal then the wrong SCB block is selected in the Device Configurator. Please select SCB5 and assign the pins - P5.1 (Tx), P5.0 (Rx) as shown -

pastedImage_8.png

pastedImage_7.png

I then programmed the project and observed that the device was going into processing fault. I commented out the Task_DebugInit() line and added the line - Cy_SCB_UART_PutString(KIT_UART_HW, "Printing\r\n"); as shown -

pastedImage_9.png

I was able to observe the "Printing" line on the serial terminal. Also I do not think the DebugPrintf() function is implemented properly. I do not think it is using the UART SCB block to send data. The reason why I think Task_DebugInit() fails is because of memory restrictions. Please try increasing the FreeRTOS heap size and the application heap size. Please refer to this thread for additional information - How to set malloc heap size on ModusToolbox 2.0.0?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
Reply
OkBa_4438736
New Contributor II

Hi RakshithM_16​,

Thank your for your answer.

How are you observing the UART output? If you are using KitProg and Serial Terminal then the wrong SCB block is selected in the Device Configurator. Please select SCB5 and assign the pins - P5.1 (Tx), P5.0 (Rx) as shown -

I am not using KitProg for UART. That is why I use SCB2 and Pins P9[0](Rx) and P9[1](Tx) for serial terminal.

I was able to observe the "Printing" line on the serial terminal. Also I do not think the DebugPrintf() function is implemented properly. I do not think it is using the UART SCB block to send data. The reason why I think Task_DebugInit() fails is because of memory restrictions. Please try increasing the FreeRTOS heap size and the application heap size. Please refer to this thread for additional information

I have been increasing the Heap size both in Application (upto 0x4400) and FreeRTOS (upto 40 KB), but these also did not provide any solution.

heap_size.jpg

What is  interesting that,the same heap memory allocations (App heap size 0x400 and FreeRTOS configTOTAL_HEAP_SIZE=16240) in MTB 1.1 used to work for our project. And its total SRAM footprint is around 37KB, but when we move the same code/project into MTB 2.1 the Heap size is 237 KB and the total SRAM footprint is around 280KB, while both them use HEAP_ALLOCATION_TYPE4.

mtw_1_1.jpg

If this is not a linker thing allocating un-used memory area as heap, it seems like there is an allocation issue.

In addition, the problem is not just serial-console and UART, in MTB 1.1, I can see that BLE is advertising while in MTB 2.1 BLE is not visible.

Regards,

0 Likes
Reply
Rakshith
Moderator
Moderator

Hi OkBa_4438736​,

I tried fixing the issue with printing in your project. I have used retarget-io middleware for the implementation of printf. Please program the project in the BLE_Battery_Level_FreeRTOS_Default_Print.zip archive file. I have disabled P5_0 and P5_1 in this project as they will be used by retarget-io. When I program this project, this is the output observed on the serial terminal application (I have used Tera Term).

pastedImage_0.png

As you are using P9_0 and P9_1 for receiving the UART data, I have created another project (BLE_Battery_Level_FreeRTOS_Custom_Print.zip) with P9_0 and P9_1 as the UART pins. I have enabled the P5_1 and P5_0 in the Device Configurator for this project as those pins are now not used for UART. There are few issues with the DFU in the project. Please follow the steps in this link to work with DFU in MTB 2.1 - DFU SDK API Reference Manual.

If you face any issue with BLE or DFU please create a new thread and an appropriate Cypress Application Engineer will help you with your issue.

Please let me know if you are able to see the debug UART info as shown in the figure above.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
Reply
OkBa_4438736
New Contributor II

Hi RakshithM_16

I have tested your solution and looks like it is working.

However, let me ask few question to understand the big picture.

(1) The custom print solution that you have provided does not use any UART hardware but just the rx and tx pins.

In this case what is the difference between using a UART hardware vs assigning rx-tx via library calls ?

(2) Is this solution thread safe in FreeRTOS environment ?

Regards,

0 Likes
Reply
Rakshith
Moderator
Moderator

Hi OkBa_4438736,

(1) The custom print solution that you have provided does not use any UART hardware but just the rx and tx pins.

In this case what is the difference between using a UART hardware vs assigning rx-tx via library calls ?

I have not used a custom print solution. I have used the retarget-io board utility middleware available in ModusToolbox since the v2.0 release. You can use this middleware by using the Library Manager tool and enabling the retarget-io as shown -

pastedImage_2.png

The retarget-io uses the UART SCB block. The UART block is not 'enabled in Device Configurator' and I think that is the reason for your query.

The retarget-io uses another feature that was introduced in ModusToolbox 2.0 release - Hardware Abstraction Layer (HAL). It is a layer above PDL to make the use of driver API easier and device-independent. HAL does not use Device Configurator and the hardware block (UART in this case) is enabled/initialized in the firmware itself. I have tried to explain the need for HAL and the difference between HAL and PDL in this thread - Issues starting with ModusToolbox IDE on Mac

You can also refer this link for information regarding specific HAL driver - Hardware Abstraction Layer (HAL)

(2) Is this solution thread safe in FreeRTOS environment ?

Yes, I have used the same files from the BLE Battery Level FreeRTOS CE (uart_debug.h and uart_debug.c). It adds a wrapper around retarget-io to make it thread-safe. You can refer to the CE for its implementation. Also, you can refer to the files cy_retarget_io.h and cy_retarget_io.c, for the implementation of retarget-io.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
Reply
OkBa_4438736
New Contributor II

Hi RakshithM_16 ,

Thank you for the answers.

I can import the project that you have modified/shared and run it without any issue.

However, I am not able to re-produce  your solution.

1. I start a new MTB application based on "BLE Battery Level FreeRTOS" example project.

2. Use library Manager to add required libraries including retarget-io.

save_dfu1.jpg

3. copy design.cybt , design.modus from the project the you have shared into the new project

4. copy all the source code files from the project the you have shared into the new project

After all of these when I program my device, it stucks after printing few lines.

save_dfu2.jpg

I am using the same source code and same size of heap for the both cases.

Regards,

0 Likes
Reply
Rakshith
Moderator
Moderator

Hi OkBa_4438736​,

Here are my observations that I could deduce from the information/screenshot shared -

1. The project is building fine. So, all the libraries and source code are imported correctly.

2. There seem to be no issues with the design.modus file too.

3.  The application is getting executed and the log is getting printed on the terminal. So, retarget-io and bsp is initialized properly.

Can you attach to the running target and debug the application? In ModusToolbox 2.1 you can attach to the running target by following these steps -

  1. Right-click on the project in the Project Explorer > Run As > Run Configurations.
  2. In the Run Configurations window under GDB OpenOCD Debugging, select Attach and click on Run.

You can find the call stack on the Debug tab next to Project Explorer.

Hope this helps,

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
Reply
Top labels