This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM572x sdk rtos custom applications build

Hi,

    How build custom applications in am572x sdk_rtos ?? I just tried to add my codes in /ti/pdk_am57xx_1_0_3/packages/ti/board/diag directory with same as example codes available within diag directory. Should i take care of makefile???? Please someone guide me.

Thanks

Chethan

  • Hi,

    The RTOS team have been notified. They will respond directly here.
  • Why this sitara rtos team won't reply to any questions????

    Chethan
  • Because they are working in the USA, where it's 6:30 AM at the moment. Please have some patience.
  • Chethan,

    See the Wiki page for Diag package: processors.wiki.ti.com/.../Processor_SDK_RTOS_DIAG

    There is a top level makefile under diag, then a second level makefile under each folder. If you want to create your own diagnostics, you can create a new folder with source file, makefile also change the top level makefile to include yours.

    Regards, Eric
  • Eric,

    Since i'm referring the same web page, but i'm not understanding how to develop my own diagnostic apps for custom board.

    1. Adding my own apps with source file means /ti/pdk_am57xx_1_0_3/packages/ti/board/diag this directory??

    2. As gone through example codes within /ti/pdk_am57xx_1_0_3/packages/ti/board/diag there are some mandatory lines of code are added within main() functions, can add directly those lines within my main() function??

    3. In one the website suggesting to generate Custom Board Library using TI PIN MUX tool, i'm confused where copy to this files within the sdk_rtos in linux environment.

    http://processors.wiki.ti.com/index.php/Processor_SDK_RTOS_Board_Support#Creating

  • Eric,

      I'm just wrote a simple gpio custom diagnostic app, which do toggling operation on a particular pin(one of gpio pin on my project), i follow the file structure within /diag and modified makefile on top level as well as within build directory makefile. I have doubt within low level makefile their what does that mean and importance???

    Makefile within ../../diag/build/evmAM572x/armv7/

    #List the Source Files
    TEST_SRC = \ -------------------------------------------------- (1)
            gpios_toggle.c

    TEST_SRC_DEV = \ --------------------------------------------(2)    
           GPIO_soc.c \
            diag_osal.c

    # Using the parse functions from SBL
    SBL_SRC = \ ----------------------------------------------------(3)
            sbl_mmcsd.c \
            sbl_rprc.c

    #Common entry object
    ENTRY_SRC = gpio_entry.S -------------------------------(4)

    The above mentioned numbers (2) and (4) giving error for my custom application(gpios_toggle) when i remove them application compile successfully and gpios_toggle.out file create within ../../bin/evmAM572x/arm7


    Now if i load this executable using sd card will it work or not??? Because i removed number (2) and (4)

    Thanks

    Chethan

  • Chethan,

    The closet GPIO toggle diag is the LED test under diag folder. From the main() functions, it calls into some GPIO_init and GPIO_write() functions. If you have GPIO library linked, then even without (2), it should be OK.

    For (4), it is diag_entry.S in our file. When you jump from framework into your indiviudal diag application, you need to save your LR, PC for your return. Also, you need to create new stack, IRQ handler and clear your .bss section, etc... Without this file linked, your own diag will not work.

    Regards, Eric
  • Eric,

       Thanks for your reply!!! Now i got clarity of how to modify makefile and all. I did follow that led code for gpio toggling application.

    Within the code main() function with necessary statements for board configs,init and toggle function call are added. I made single source file within that macro defined with gpio pin and used GPIO_write() API to do toggle operation, is this ok or should i take care of something???? I did this so far and code compiled successfully and i find the exe in ../../bin directory.

    Thanks,

    Chethan

  • Chethan,

    In you GPIO example, you also need the board_init() with BOARD_INIT_UART_STDIO flag only. The BOARD_INIT_PINMUX_CONFIG has been taken care of by the SBL. So, if you run the app from SD card, the MLO is SBL and does the PINMUX; if you run your app from CCS/JTAG standalone, then you need pass PINMUX flag to your board_init().

    Regards, Eric

  • Eric,

    Here is my code. As my understanding this code may work on evm not on custom board because haven't take care of pinmux,clocking etc i just took a designed gpio on my board and using API did toggle operation. I hope you understand my confusion, for this single gpio operation also i should do pinmux, clocking,DDR right?? If so how to do that and where to copy those pinmux,clocking file in rtos_sdk.

     #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    #include <ti/drv/gpio/GPIO.h>
    #include <ti/drv/gpio/soc/GPIO_v1.h>

    #include <ti/drv/uart/UART.h>
    #include <ti/drv/uart/UART_stdio.h>
    #include <soc.h>

    #include "board.h"
    #include "board_cfg.h"

    void delay(unsigned int cnt);
    int ics_gpio_toggle();

    #define GPIO_PIN_VAL_LOW        (0U)
    #define GPIO_PIN_VAL_HIGH       (1U)

    #define KEYPAD_LEFT_KEY  92/* 3 , 28 Bank_number, pin_no */

    int ics_gpio_toggle(){

            unsigned int i;
            GPIO_init();
            printf("\n*********************************************\n");
            printf("*                 GPIO's Test                  *\n");
            printf("*********************************************\n");

            for(i=0; i<100; i++){
                    GPIO_write(KEYPAD_LEFT_KEY,GPIO_PIN_VAL_HIGH);
                    printf("GPIO write----1\n");
                    delay(1000);
                    GPIO_write(KEYPAD_LEFT_KEY, GPIO_PIN_VAL_LOW);
                    printf("GPIO write----0\n");
                    delay(1000);
            }
            return 0;
    }

    void delay(unsigned int cnt)
    {
            unsigned int j=0;
            for(j=0;j<cnt;j++);

    }

    int main(void)
    {
        Board_initCfg boardCfg;

        boardCfg = BOARD_INIT_MODULE_CLOCK | BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_UART_STDIO;

        Board_init(boardCfg);

        return ics_gpio_toggle();
    }

    Chethan

  • How the GPIO controls LED is HW specific. For example, on our IDKAM571x EVM, there are 4 industrial LEDs and 2 status LEDs, such LED is tri-state (red, green, yellow). So there needs 18 (=6x3) GPIO pins control them, this is defined in GPIO_LED_config.c like:

    #define LED1 (0x0613)
    #define LED2 (0x0400)
    #define LED3 (0x0104)
    #define LED4 (0x0607)
    #define LED5 (0x021D)
    #define LED6 (0x0105)
    #define LED7 (0x0709)
    #define LED8 (0x0708)
    #define LED9 (0x070A)
    ....

    For each GPIO pin, they are multiplexd with others. So you must use PINMUX to set it. For example, LED1 uses ball# B26, you must set B26 to pinmux mode 14 to be used as GPIO6_19.

    For your own board, you need to look at the schematic to understand how many LEDs are there, which one you want to toggle (e.g, #define KEYPAD_LEFT_KEY 92/* 3 , 28 Bank_number, pin_no */, where this connected to ball number, ia it E1?), then you need to set this to GPIO mode for MUX.

    For DDR, if you code uses it, you need initialize it.

    For clock, DDR, PINMUX, please look at processors.wiki.ti.com/.../Processor_SDK_RTOS_Board_Support. Those code are HW dependent, our board source code are below: \pdk_am57xx_1_0_x\packages\ti\board\src.

    Regards, Eric
  • Eric,

        Thank you for reply!!!!

    So far we have understood stand alone application like simple gpio test without device driver involvement, suppose consider my application deals with device drivers because other my applications have device driver nodes within applications.

    Please explain me this doubt briefly. So far i understood whole diagnostic applications runs in SBL(Secondary Boot Loader) there is no kernel comes under this picture(because sdcard contains only MLO and apps----correct me if my misconception) so OS no drivers. 

    1. How to add application contains device node??

    2. Suppose an application contains command line argument within main() how to handle those??

    Thanks

    Chethan

  • Chethan,

    I didn't understand the first question, can you explain? What dod you mean application containing device node?

    For the second question, please take a look for the following links:
    e2e.ti.com/.../86832
    e2e.ti.com/.../3263
    e2e.ti.com/.../36444

    Regards, Eric
  • Eric,

       What i want you to ask is since our custom boards codes has been wrote and tested on hardware in linux environment. Now we are using sdk_rtos porting the application to sdk_rtos format. So we applications which run with device drivers, so my basic doubt is since this RTOS framework runs in SBL no OS will be involved so how i suppose to run an complex code which involving I2C SPI etc. This i my doubt!!!

       But later understood that while buiding pdk board librarys will generate those contains set of APIs, function definitions etc Am i correct???

    Please explain in detail.

    Regards,

    Chethan

  • Chethan,

    The Diag package is designed as bare metal program without any OS requirement, it more likes a power on test. The RTOS processor SDK has both Windows installer and Linux installer, so you can create SD card containing the diagnostic applications either from Windows or Linux PC.

    There is another Linux Processor SDK package that runs the Linux OS, processors.wiki.ti.com/.../Processor_SDK_Linux_Getting_Started_Guide. Those individual periphrals are intialized by Linux OS already. From user space, you can run some commands like lsusb, lspci, if they returns the right results, then the periphrals and Linux driver are working. If you can boot up/ping through the network, that means SGMII is working. If you can see the printout from UART, that means UART is working ....Under embedded Linux, those are more system level proof of individual periphrals are working.

    I think you can use bare metal Diag without OS to make sure the board HW is working. Then develop Linux applications to make sure the drivers are right.

    Regards, Eric
  • Eric,

      Sorry for the late response!!!! thanks your explanation.

    I just developed I2C related apps and UART related apps that has test on custom hardware, now i'm developing SPI related apps this one really bigger for me because the SDK which i'm supporting very few API's but our apps requires lots of functionalities(SPI is main interface of the project). So my question is ioctl kind of operations how can i develop?? Should i  write custom functions for that?? Please share your thoughts.

    BR

    Chethan