Hello, I've been working with a custom board that uses the MIMXRT1062DVJ6B for a while. Recently, as I wanted to start working on the OTA, I've tried reducing the code size by changing the gcc flag from -O0 to -Os. When I do this, the i2c communication breaks: when writing data to the slave, I get a timeout error when sending the STOP (LPI2C_MasterStop returns 909 which matches kStatus_LPI2C_Timeout). I got the same results with -O1.
The code I use for the i2c is pretty much identical to the master polling_b2b example from the SDK. The only differences are that I use LPI2C_MasterStart instead of LPI2C_MasterRepeatedStart when reading from a slave and that I included a mutex to lock access to the bus.
Is there anything specific I should look at in this case ?
Environment:
- arm-none-eabi-gcc 10.3.1 20210824
- SDK 2.13.0 built for linux
My flags:
SET(CMAKE_C_FLAGS_FLEXSPI_NOR_DEBUG " \
${CMAKE_C_FLAGS_FLEXSPI_NOR_DEBUG} \
-include ${ProjDirPath}/../app_config.h \
-DXIP_EXTERNAL_FLASH=1 \
-DXIP_BOOT_HEADER_ENABLE=1 \
-DXIP_BOOT_HEADER_DCD_ENABLE=1 \
-DSKIP_SYSCLK_INIT\
-DDEBUG \
-DCPU_MIMXRT1062DVL6B \
-DSDIO_ENABLED=1 \
-DMMC_ENABLED=1 \
-DFSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1 \
-DAPPL_USE_STANDARD_IO \
-DGATT_CLIENT \
-DGATT_DB \
-DFSL_DRIVER_TRANSFER_DOUBLE_WEAK_IRQ=0 \
-DSDK_COMPONENT_INTEGRATION=1 \
-DgNvStorageIncluded_d=1 \
-DgNvTableKeptInRam_d=1 \
-DIOT_WIFI_ENABLE_SAVE_NETWORK=1 \
-DFSL_OSA_MAIN_FUNC_ENABLE=0 \
-DHAL_UART_ADAPTER_FIFO=1 \
-DFSL_FEATURE_FLASH_PAGE_SIZE_BYTES=4096 \
-DgMemManagerLight=0 \
-DUSE_RTOS=1 \
-DOSA_USED=1 \
-DPH_OSAL_FREERTOS \
-DPRINTF_ADVANCED_ENABLE=1 \
-DSDK_OS_FREE_RTOS \
-DFSL_OSA_TASK_ENABLE=1 \
-DDEBUG_CONSOLE_TRANSFER_NON_BLOCKING \
-DCFG_BLE \
-DLPUART_RING_BUFFER_SIZE=1024U \
-DNVM_NO_COMPONNET=1 \
-DCPU_MIMXRT1062DVL6B_cm7 \
-DHAL_UART_DMA_ENABLE=1 \
-DHAL_AUDIO_DMA_INIT_ENABLE=0 \
-DLFS_NO_INTRINSICS=1 \
-DLFS_NO_ERROR=1 \
-DSERIAL_PORT_TYPE_UART=1 \
-DLOG_ENABLE_ASYNC_MODE=1 \
-DLOG_MAX_ARGUMENT_COUNT=10 \
-DLOG_ENABLE_OVERWRITE=0 \
-DCONFIG_ARM=1 \
-DDATA_SECTION_IS_CACHEABLE=0 \
-DMFLASH_FILE_BASEADDR=7340032 \
-DMCUXPRESSO_SDK \
-g \
-Os \
-mcpu=cortex-m7 \
-Wall \
-mthumb \
-MMD \
-MP \
-fomit-frame-pointer \
-Wno-unused-function \
-fno-common \
-ffunction-sections \
-fdata-sections \
-ffreestanding \
-fno-builtin \
-mapcs \
-std=gnu99 \
${FPU} \
${DEBUG_CONSOLE_CONFIG} \
")