# libgsm **Repository Path**: hanhai-modules/libgsm ## Basic Information - **Project Name**: libgsm - **Description**: 来自黑芝麻智能科技(bstai)瀚海(hanhai)的跨域状态管理模块 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2025-01-16 - **Last Updated**: 2025-12-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # libgsm ## 1. Organization To satisfy C1200, it is inevitable to run GSM on both Linux system and FreeRTOS system. - Linux: ADAS, DB and IVI. - FreeRTOS: Realtime Core0 ~ Core5 (rt0 ~ rt5) and Switch Core0 ~ Core5 (sw0 ~ sw5). We provide one gsm-daemon on the rt3 system, in addition with the uniform API of 3 gsm-clients and their corresponding demos, which are deployed on ADAS system, rt0 system and sw5 system. Specifically, there are 8 folders to organize all codes. - fidl: The fidls and the corresponding tool, which generates the msgbox codes used to communicate among different cores. - freertos_daemon: The gsm-daemon task and server deployed on the rt3 system. - freertos_client: The gsm-client API and implementations used by Realtime or Switch system. - freertos_demo: The demo deployed on the freeRTOS system. - linux_client: The gsm-client API and implementations used by ADAS or DB system. - linux_debug: The debug command deployed on the ADAS system. - linux_demo: The demo deployed on the Linux system. - linux_test: The API test deployed on Linux system, via gtest. - utils: The common parameters and functions, including serialization and deserialization,used among daemon and clients, i.e., among ADAS/DB/Realtime/Switch system. ## 2. gsm-daemon As previously described, gsm-daemon is deployed on the rt3 system, using the codes of the follow folders. - freertos_daemon. - utils. Hence, there are 4 modifications in other places. 1. Modify the Manifest.xml of `realtime_freertos_core3` as follows. ```xml ``` 2. Modify the Makefile of `rt_freertos_app_core3` as follows. ```Makefile # APP header path C_INCLUDES += -I $(TOP_DIR)/rt_appl/user/gsm_daemon_app C_INCLUDES += -I $(TOP_DIR)/rt_appl/user/gsm_daemon_app/utils C_INCLUDES += -I $(TOP_DIR)/rt_appl/user/gsm_daemon_app/freertos_daemon # APP source code path C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_daemon_app/utils/gsm_error_info.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_daemon_app/utils/gsm_state_conf.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_daemon_app/freertos_daemon/src-gen/GlobalSharedData_server.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_daemon_app/freertos_daemon/src-gen/gsm_msgbx_server.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_daemon_app/freertos_daemon/gsm_server.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_daemon_app/freertos_daemon/gsm_daemon_task.c # APP compile flag GCCFLAGS += -DHANHAI_GSM ``` 3. Modify the `bsw_app` to start `gsm-daemon` automatically when the device is startup. ```C // rt_appl/user/bsw_app/BswInit.c #ifdef HANHAI_GSM #include "gsm_daemon_task.h" ... create_gsm_daemon_task(); #endif ``` 4. Modify the defination of Task in `rt_freertos_hal_core3`. ```C #ifdef HANHAI_GSM GsmDaemonReceiveTask , GsmDaemonCheckTask , #endif ``` If you want to compile the system, please execute the script in `rt_freertos_app_core3`. ```shell ./make.sh clean ./make.sh all ``` ## 3. gsm-client and demo ### 3.1 ADAS/DB system The gsm-client, demo and debug command deployed on the ADAS/DB system, using the codes of of the follow folders. - linux_client. - utils. - linux_demo. - linux_debug. According the CMakelists and the corresponding codes and files, we can build the corresponding bpk packages to be installed as follows. - hanhai-gsm: including dynamic libraries for gsm-client on the Linux system. - hanhai-gsm-dev: including the API headers of gsm-client on the Linux system. - hanhai-gsm-demo: including the demo codes and executation on the Linux system. - hanhai-gsm-test: including the test codes and executation on the Linux system. - hanhai-gsm-doc: including the API reference and user guides. ### 3.2 rt0 system The gsm-client and demo deployed on the rt0 system, using the codes of of the follow folders. - freertos_client. - utils. - freertos_demo. There are 3 modifications in other files. 1. Modify the Manifest.xml of `realtime_freertos_core0` as follows. ```xml ``` 2. Modify the Makefile of `rt_freertos_app_core0` as follows. ```Makefile # APP header path C_INCLUDES += -I $(TOP_DIR)/rt_appl/user/gsm_app C_INCLUDES += -I $(TOP_DIR)/rt_appl/user/gsm_app/utils C_INCLUDES += -I $(TOP_DIR)/rt_appl/user/gsm_app/freertos_client # APP source code path C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_app/utils/gsm_error_info.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_app/utils/gsm_state_conf.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_app/freertos_client/src-gen/GlobalSharedData_client.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_app/freertos_client/src-gen/freertos_gsm_msgbx_client.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_app/freertos_client/gsm_client.c C_SOURCES += $(TOP_DIR)/rt_appl/user/gsm_app/freertos_demo/gsm_client_demo_cmd.c # APP compile flag GCCFLAGS += -DHANHAI_GSM ``` 3. Modify the defination of Task in `rt_freertos_hal_core0`. ```C #ifdef HANHAI_GSM GsmClientDemoTask , #endif ``` If you want to compile the system, please execute the script in `rt_freertos_app_core0`. ```shell ./make.sh clean ./make.sh all ``` ### 3.3 sw5 system The gsm-client and demo deployed on the sw5 system, using the codes of of the follow folders. - freertos_client. - utils. - freertos_demo. There are 3 modifications in other files. 1. Modify the Manifest.xml of `c1200_switch5` as follows. ```xml ``` 2. Modify the Makefile of `sw5_appl` as follows. ```Makefile # APP header path C_INCLUDES += -I $(TOP_DIR)/sw_appl/user/gsm_app C_INCLUDES += -I $(TOP_DIR)/sw_appl/user/gsm_app/utils C_INCLUDES += -I $(TOP_DIR)/sw_appl/user/gsm_app/freertos_client # APP source code path C_SOURCES += $(TOP_DIR)/sw_appl/user/gsm_app/utils/gsm_error_info.c C_SOURCES += $(TOP_DIR)/sw_appl/user/gsm_app/utils/gsm_state_conf.c C_SOURCES += $(TOP_DIR)/sw_appl/user/gsm_app/freertos_client/src-gen/GlobalSharedData_client.c C_SOURCES += $(TOP_DIR)/sw_appl/user/gsm_app/freertos_client/src-gen/freertos_gsm_msgbx_client.c C_SOURCES += $(TOP_DIR)/sw_appl/user/gsm_app/freertos_client/gsm_client.c C_SOURCES += $(TOP_DIR)/sw_appl/user/gsm_app/freertos_demo/gsm_client_demo_cmd.c # APP compile flag GCCFLAGS += -DHANHAI_GSM ``` 3. Modify the defination of Task in `sw5_hal`. ```C #ifdef HANHAI_GSM GsmClientDemoTask , #endif ``` If you want to compile the system, please execute the script in `sw5_appl`. ```shell ./make.sh clean ./make.sh all ``` ### 3.4 How to execute demo Please execute: ```Shell gsm_client_demo_FG ``` `` varies from 1 to 6. FG1/FG2/FG3/FG4 can be used on the Linux system, FG5/FG6 can be used on the RreeRTOS system. For exampple: Open the Terminate 1 on the ADAS system,and execute `/usr/bin/examples/gsm-demo/gsm_client_demo_FG 1` `/usr/bin/examples/gsm-demo/gsm_client_demo_FG 2` `/usr/bin/examples/gsm-demo/gsm_client_demo_FG 3` Open the Terminate 2 on the DB system,and execute `/usr/bin/examples/gsm-demo/gsm_client_demo_FG 4` Open the Terminate 3 on the rt0 system,and execute `gsm_client_demo_FG 5` Open the Terminate 4 on the sw5 system,and execute `gsm_client_demo_FG 6` ### 3.5 How to debug via command Please execute these commands on the Linux system. - Print the help information of gsm command: `gsm -h` - Print the loaded state conf list: `gsm -c` - Print the collected state map: `gsm -m` - Print the state error info: `gsm -e` ## 4. Prerequisite - gtest: licensed under the BSD 3-Clause License. - hanhai-libdmabufheap: licensed under the Apache-2.0 License. - hanhai-ipc: licensed under the Apache-2.0 License. ## 5. License hanhai-gsm is licensed under [Apache-2.0](LICENSE).