<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Zephyr include LZ4 Frame</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111313/zephyr-include-lz4-frame</link><description>The example for LZ4 works fine, however I want to use the frame format and not block format. 
 Therefore I added #include &amp;quot;lz4frame.h&amp;quot; to my main.c and tried to use LZ4F_compressFrame(). 
 But the compiler prints undefined reference to `LZ4F_compressFrame</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 22 May 2024 10:18:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111313/zephyr-include-lz4-frame" /><item><title>RE: Zephyr include LZ4 Frame</title><link>https://devzone.nordicsemi.com/thread/485356?ContentTypeID=1</link><pubDate>Wed, 22 May 2024 10:18:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46000eb0-3f93-4f52-82a3-13c66dead94f</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am not sure what could be the problem here.&lt;/p&gt;
&lt;p&gt;One could think of buffer being Null, but that is not indicated in the snapshot.&lt;/p&gt;
&lt;p&gt;Can you start debugging and see if it helps.&lt;/p&gt;
&lt;p&gt;I can also look if you attach your minimal project as you have right now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr include LZ4 Frame</title><link>https://devzone.nordicsemi.com/thread/484879?ContentTypeID=1</link><pubDate>Sun, 19 May 2024 10:15:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5581cab-2911-4ea0-bcef-44dcb8bb571f</guid><dc:creator>Leschge</dc:creator><description>&lt;p&gt;Small update, I got it running using the CMakeLists directly, however it crashed at&amp;nbsp;LZ4F_compressFrame(), more specific in the MEM_INIT() function:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1716113696794v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;This is my code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	static const unsigned char src[24] = {0x46, 0x3d, 0xff, 0xff, 0x7b, 0x62, 0xf3, 0xb0, 0x7f, 0xdc, 0xff, 0x87,
										  0x8f, 0x63, 0x7f, 0x7e, 0x9e, 0x67, 0xbe, 0x13, 0x5c, 0xfe, 0xc0, 0xff};

	const int max_dst_size = LZ4F_compressFrameBound(sizeof(src), NULL) * 2;

	char *compressed_data = malloc((size_t)max_dst_size);

	if (compressed_data == NULL)
	{
		printk(&amp;quot;Failed to allocate memory for compressed data\n&amp;quot;);

		return 0;
	}

	const int compressed_data_size = LZ4F_compressFrame(compressed_data, max_dst_size, src, sizeof(src), NULL);

	if (compressed_data_size &amp;lt;= 0)
	{
		printk(&amp;quot;Failed to compress the data\n&amp;quot;);
		return 0;
	}

	printk(&amp;quot;Original Data size: %d\n&amp;quot;, sizeof(src));
	printk(&amp;quot;Compressed Data size : %d\n&amp;quot;, compressed_data_size);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>