|
1 |
| -# stm32mp1 |
| 1 | +# stm32mp1 |
| 2 | + |
| 3 | + |
| 4 | +## This repository contains project done on STM32Mp157C-DK2 Kit, which utilizes both ARM Cortex A7 and ARM Cortex M4 processors. |
| 5 | + |
| 6 | +M4 part generates some data and send it to A7. |
| 7 | +A7 has a server running which accepts messages and copy those into a shared memory region which will be read by some other application. |
| 8 | +Other Application takes data from shared memory and is responsible to process that data according to message request. |
| 9 | + |
| 10 | +_________________________________________________________________________________________________________________ |
| 11 | +| ________ ________ | |
| 12 | +| |Core 1| |Core 2| | |
| 13 | +| ======== ======== | |
| 14 | +| Shared Memory Region | |
| 15 | +| -------------------------- | | ------------------------ | |
| 16 | +| | IPC Sender |=====>| |==========>| IPC Reader | | |
| 17 | +| -------------------------- | | ------------------------ | |
| 18 | +| || | | | |
| 19 | +| -------------------------- | | ------------------------- | |
| 20 | +| | Active Request Handler | | | | Thread Pool Processing | | |
| 21 | +| -------------------------- | | ------------------------- | |
| 22 | +| || | | | |
| 23 | +| |------------------------ | | | |
| 24 | +| | | | | | |
| 25 | +| | SERVER | | | | |
| 26 | +| ------------------------- | | | |
| 27 | +| || ^ || | | | |
| 28 | +| || | || | |
| 29 | +| || | || | |
| 30 | +| | |
| 31 | +|-----------------ttyRPMSG0-------------------------------------------------------------------------------------| |
| 32 | +| // || \\ | |
| 33 | +| /// || \\\ | |
| 34 | +| ||| || ||| | |
| 35 | +| ||| || |||<--- Sending some Message in particular format | |
| 36 | +| ||| || ||| | |
| 37 | +| ||| || -------------------- | |
| 38 | +| ||| ========================== M4 Processor | |
| 39 | +| ------------------------------ | |
| 40 | +| | |
| 41 | +| | |
| 42 | +| Fig. Sample Processing inside system | |
| 43 | +| | |
| 44 | +| | |
| 45 | +----------------------------------------------------------------------------------------------------------------- |
| 46 | + |
| 47 | + |
| 48 | +Folders Description: |
| 49 | + |
| 50 | +1. Utilities (C++) |
| 51 | +Utility Library containing following functionalties: |
| 52 | + a. PMR (Polymorphic Resource Allocator) which can be used with C++14. Only Monotonic Buffer resource is added but others can be added easily. |
| 53 | + b. POSIX Shared Memory Adaptor layer. |
| 54 | + c. POSIX Semaphore Adaptor layer. |
| 55 | + d. Thread Pool: can be used to process parallel requests of same type or different. |
| 56 | + e. Generic Signal Handler Interface: used to handle signals in system and can also call System Reset Handler. |
| 57 | + f. Generic Reset Handler Interface: used to handle system level failures. |
| 58 | + |
| 59 | +This library can be used as a generic library in any project where some system programming using C++ is needed. Particularly for Automotive where C++14 is being used. |
| 60 | +It can easily be extended for further enhancements. |
| 61 | + |
| 62 | + |
| 63 | +2. HtServer (C++) |
| 64 | +Small Server Application to receive data from M4 Core. It process the requests and put the data into shared memory region. |
| 65 | +It has 3 major sections: |
| 66 | + a. Initialization of Application |
| 67 | + b. Core Server to receive data |
| 68 | + c. IPC channel using shared memory |
| 69 | + |
| 70 | +It receives data on ttyRPMSG0 channel. Whenever a request comes it is placed into a queue using active thread which transfers data to shared memory using request queue in a separate thread. |
| 71 | + |
| 72 | + |
| 73 | +3. HtClient (C++) |
| 74 | +Application to read data from shared memory and process each request. |
| 75 | +It also has 3 major sections: |
| 76 | + a. Initialization of Application |
| 77 | + b. Core Receiver |
| 78 | + c. IPC channel |
| 79 | + |
| 80 | +it receives data from shared memory and put the request into a separate thread. Just priting the received message as dummy processing. |
| 81 | + |
| 82 | + |
| 83 | +4. M4A7Comm (C) |
| 84 | +It is OpenAMP-FreeRTOS based sample application whcih sends some data to A7 core using ttyRPMSG0. There is a possibility to receive data from A7 also using ttyRPMSG0. |
| 85 | + |
| 86 | +It has majorly 3 Threads: |
| 87 | + a. LED Task to blink led or some regular system related tasks |
| 88 | + b. OpenAMP Receive Task: to check the data on virtual UARTs |
| 89 | + c. Send Data Thread: sends data in particular format to ttyRPMSG0 after a fixed interval. Actual ADC data or other different data can also be sent accoridng the system behavior. |
| 90 | + |
| 91 | +[It also receives data from A7 and sends it back to A7 (whatever was sent from there) on ttyRPMSG0, can easily be found official website as a demo part.] |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +How to Build: |
| 96 | + |
| 97 | +yocto_steps.txt file can be found to build A7 (Linux Application) using yocto project. |
| 98 | + |
| 99 | +Simple cmake can be used to build CM4 based projects. |
| 100 | + a. Create build folder in project directory |
| 101 | + b. Go to build directory. cmake .. and then make |
| 102 | +It should generate following files after successful compilation: |
| 103 | +linker.map, M4A7CommApp.bin, M4A7CommApp.elf, M4A7CommApp.hex |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +Cheers!! |
| 110 | +Happy to Help and Share :-) |
| 111 | + |
0 commit comments