Thalhammer / simcom_dam

Examples for simcoms downloadable modules (Qualcomm SoC)
28 stars 13 forks source link

Inconsistent behaviour between gcc and armcc #3

Open Thalhammer opened 5 years ago

Thalhammer commented 5 years ago
qapi_GPIO_ID_t     gpio_id = 0;
qapi_TLMM_Config_t tlmm_config;
qapi_Status_t      status = QAPI_OK;

memset(&tlmm_config, 0, sizeof(tlmm_config));
tlmm_config.pin = 8; // Pin 11 is GPIO3
tlmm_config.func = 0;
tlmm_config.dir = QAPI_GPIO_INPUT_E;
tlmm_config.pull = QAPI_GPIO_PULL_UP_E;
tlmm_config.drive = QAPI_GPIO_2MA_E;

status = qapi_TLMM_Get_Gpio_ID( &tlmm_config, &gpio_id);

if (status == QAPI_OK) {
    status = qapi_TLMM_Config_Gpio(gpio_id, &tlmm_config);
}

In armcc everything works fine, but gcc somehow modifies the first byte/word of tlmm_config in the call to qapi_TLMM_Get_Gpio_ID and writes a zero there, causing the consecutive call to qapi_TLMM_Config_Gpio to fail with ERR_INVALID_PARAM. I don't know why this happens only in gcc. This is a tracking issue to gather ideas until I figured this out.