Cypress EZ-USB® FX3™ SDK Quick Start Guide, Version 1.3.1 40
The CyU3PToolChainInit function zeroes out the whole of the BSS segment
(ranging from _bss_start to _bss_end), and then jumps to the main() function that is
defined in cyfxgpiftousb.c.
The code flow from this point on is described below. Please refer to the code in
cyfxgpiftousb.c file to understand how these operations are performed in code.
1. The main function uses the CyU3PDeviceInit() to set up the clocks for the
FX3 system.
2. The CyU3PDeviceCacheControl function is used to enable the required
caches. This example enables only the Instruction cache. If the data cache
is enabled, the cache handling in the DMA APIs also needs to be enabled.
3. Use the CyU3PDeviceConfigureIOMatrix function to configure the IO
functionalities used in this application. The GPIF-II bus is configured as 32
bit so that the maximum data throughput is achieved on the GPIF-II port.
UART is enabled for debugging, and no other serial interfaces are enabled.
4. Call the CyU3PKernelEntry() function to start off the ThreadX RTOS
scheduler. This is a non-returning function call, and no further code is placed
in the main() function.
1
5. Once the RTOS has been started up, the scheduler calls the
CyFxApplicationDefine(). The user can define all threads and other OS
objects required by the application in this function. In this case, the
CyFxApplicationDefine() function only creates a thread which implements
the core application logic. The priority for this thread is set to 8 (the default
priority for all example application threads) and the thread stack size is
defined as 4 KB. Time slicing is not enabled, and the OS is instructed to start
the thread as soon as possible using the CYU3P_AUTO_START parameter.
6. The remaining part of the code flow is application specific. When the device
is reset, all of the external interface blocks (USB, GPIF-II, UART, I2C, SPI,
I2S and Storage) are left disabled and powered off. Therefore, the
corresponding driver threads will have no work to do and will remain idle.
Device operation will only start when each of the required blocks is enabled
by user code. This is done in the entry functions of the various threads
created in the CyFxApplicationDefine() function.
7. The first operation performed by the CyFxAppThread_Entry() function is to
enable the UART on the device for logging. This is done in the
CyFxApplnDebugInit() function. The steps involved in doing this are:
a. Calling CyU3PUartInit() to initialize the UART. This function will only
succeed if the useUart flag has been set to CyTrue in the device IO
configuration.
1
Steps 1 through 4 are expected to be similar in all FX3 applications. Only the parameters passed
to the functions will change based on the system design.