Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Scan application in Amazon FreeRTOS

lock attach
Attachments are accessible only for community members.

Scan application in Amazon FreeRTOS

PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

This blog post discusses the procedure to create a new application in Amazon FreeRTOS(AFR).

The SHA1 for repository cloned for this blog post is dae010944f32b403acff8a5a888222da11b8b5a4.

Please follow the steps mentioned in Getting Started with the Cypress CYW943907AEVAL1F Development Kit - Amazon FreeRTOS to setup AFR for CYW943907EVAL1F or CYW54907AEVAL1F

We will be using the APIs provided in AFR for writing SCAN application in this blog.

 

Please follow the steps mentioned below for adding scan application in AFR:

1. We will be forking the AFR repository and will make changes in the forked repository. Visit the FreeRTOS github repository and fork the repo.

Download the repository:

git clone https://github.com/<user_name>/amazon-freertos.git

pastedImage_2.png

 

2. To get your repository structure as per the repository used for this blog, checkout the mentioned SHA1:

git checkout dae010944f32b403acff8a5a888222da11b8b5a4

The same steps might be valid for a newer version of AFR with minor changes.

3. You will see an aws_demos project in WICED when you import the aws_demos project.

Let us add the new application in demos directory of aws_demos. Go to the exact path of demos directory in your cloned repo: I have it in C:\afr\amazon-freertos\demos

Create a new folder named scan.

pastedImage_2.png

4. Place the attached files(cy_scan.h and cy_scan.c) in the scan folder.

5. The scan folder is kept at the absolute path but is not linked in the aws_demos project in WICED hence it will not appear in the demos directory in aws_demos project in WICED.

To establish a link,  open .project file of the project in text editor and add the link in <linkedResources> as follows:

        <link>

            <name>demos/scan/cy_scan.c</name>

            <type>1</type>

            <locationURI>BASE_DIR/demos/scan/cy_scan.c</locationURI>

        </link>

        <link>

            <name>demos/scan/cy_scan.h</name>

            <type>1</type>

            <locationURI>BASE_DIR/demos/scan/cy_scan.h</locationURI>

        </link>

6. Open the iot_demo_runner.h file and add the following two lines along with the other MACROS defined:

 

#elif defined (CONFIG_CY_SCAN_DEMO_ENABLED)

    #define DEMO_entryFUNCTION                              vStartScanDemo

 

The vStartScanDemo is written in cy_scan.c file.

7. Open the aws_demo_config.h file and enable the defined MACRO instead of CONFIG_MQTT_DEMO_ENABLED

#define CONFIG_CY_SCAN_DEMO_ENABLED

 

8. Open the application makefile(aws_demos/vendors/cypress/WICED_SDK/apps/demo/aws_demo/aws_demo.mk) and add the file names as follows:

Add the cy_scan.c file in $(NAME)_RESOURCES

     $(AMAZON_FREERTOS_PATH)demos/scan/cy_scan.c \

Add the cy_scan.h file in GLOBAL_INCLUDES

    $(AMAZON_FREERTOS_PATH)demos/scan \

 

9. Build the target by clicking on the provided make target

demo.aws_demo-CYW943907AEVAL1F-FreeRTOS-LwIP HOST_OS=Win32 download run

 

10. Open serial terminal and check the UART logs for scan result:

pastedImage_19.png

Attachments
668 Views