AnsweredAssumed Answered

LibJPEG Hard Fault

Question asked by Matt Barclay on Sep 18, 2017
Latest reply on Sep 20, 2017 by AvaTar

I have a STM32F413CHU6 processor using FreeRTOS and LibJPEG as configured by STM32CubeMX.  LibJPEG is configured to use FreeRTOS memory allocation, and FreeRTOS heap is set at 150,000.


I'm trying to read JPEG data from memory.  My jpeg data are declared as:


 const uint8_t mydata[]  = { 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, ... ... ... };

I set up the decode session like this:


struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
uint8_t m_rowBuffer[2048];


JSAMPROW buffer[2] = {0};
uint32_t row_stride = 0;
buffer[0] = m_rowBuffer;


cinfo.err = jpeg_std_error(&jerr);
jpeg_mem_src(&cinfo, mydata, 4035);
jpeg_read_header(&cinfo, TRUE);



EDIT:  I solved a data corruption issue that was causing a crash in read_marker().  However, even with good JPEG data, it will wind up crashing into the Hard Fault Handler.


Not really sure where to go from here.  Has anyone had success with LibJPEG reading from memory on the STM32?