Hi All!
I'd like to ask if anybody succeeded running zephyr without optimizations?
For ex. i have a following code:
static void i2c_event_handler( nrfx_twim_evt_t const *p_event, void *p_context )
{
tPtHalI2C_twimData *dev_data = p_context;
switch( dev_data->transferType )
{
case NRFX_TWIM_XFER_TX:
{
appTxEventHandler();
}
break;
case NRFX_TWIM_XFER_TXRX:
case NRFX_TWIM_XFER_RX:
{
appRxEventHandler();
}
break;
default:
{
/* Nothing to do here */
}
break;
}
}
static uint8_t m_i2c_twmData[10] = {0};
static uint8_t m_i2c_txBuf[255];
int main() {
nrfx_twim_xfer_desc_t cur_xfer =
{
.address = SLAVE_ADDRESS,
.type = NRFX_TWIM_XFER_TX,
.p_primary_buf = m_i2c_txBuf,
.primary_length = 0,
.p_secondary_buf = NULL,
.secondary_length = 0,
};
nrfx_twim_init( &get_dev_config( nordic_device )->twim,
&get_dev_config( nordic_device )->config,
i2c_event_handler,
&m_i2c_twmData[0] );
nrf_twim_frequency_set( inst->p_twim, NRF_TWIM_FREQ_400K );
nrfx_twim_enable( &get_dev_config( nordic_device )->twim );
nrfx_err_t res = nrfx_twim_xfer( &get_dev_config( nordic_device )->twim,
&cur_xfer,
0 );
}
Now i have following problems:
1) If i set optimization level to O0, then Zephyr even doesn't start :) - Why? is there any chance to run zephyr under nRF5340 without optimization
2) If i set optimization level to O1, then Zephyr starts, but i2c_event_handler doesnt get called (unless i start board with debugger)
3) If i set optimization level to O2, then everything works fine but debugging is painful.
Do anyone knows how to run zephyr without optimizer? Why i have such problems?