chef: Fix building esp32 examples on darwin and some iram optimizations (#33529)

diff --git a/examples/chef/chef.py b/examples/chef/chef.py
index 816840f..d3b9fae 100755
--- a/examples/chef/chef.py
+++ b/examples/chef/chef.py
@@ -696,11 +696,20 @@
         if options.build_target == "esp32":
             shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/esp32")
             if options.enable_ipv4:
-                shell.run_cmd(
-                    "sed -i 's/CONFIG_DISABLE_IPV4=y/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/g' sdkconfig ")
+                if sys.platform == "darwin":
+                    shell.run_cmd(
+                        "sed -i '' 's/CONFIG_DISABLE_IPV4=y/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/g' sdkconfig ")
+                else:
+                    shell.run_cmd(
+                        "sed -i 's/CONFIG_DISABLE_IPV4=y/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/g' sdkconfig ")
             else:
-                shell.run_cmd(
-                    "sed -i 's/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/CONFIG_DISABLE_IPV4=y/g' sdkconfig ")
+                if sys.platform == "darwin":
+                    shell.run_cmd(
+                        "sed -i '' 's/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/CONFIG_DISABLE_IPV4=y/g' sdkconfig ")
+                else:
+                    shell.run_cmd(
+                        "sed -i 's/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/CONFIG_DISABLE_IPV4=y/g' sdkconfig ")
+
             shell.run_cmd("idf.py build")
             shell.run_cmd("idf.py build flashing_script")
             shell.run_cmd(
diff --git a/examples/chef/esp32/sdkconfig.defaults b/examples/chef/esp32/sdkconfig.defaults
index 327e0d2..fc09afa 100644
--- a/examples/chef/esp32/sdkconfig.defaults
+++ b/examples/chef/esp32/sdkconfig.defaults
@@ -62,6 +62,7 @@
 
 # IRAM optimizations
 CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
+CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
 
 # Increase LwIP IPv6 address number
 CONFIG_LWIP_IPV6_NUM_ADDRESSES=6
diff --git a/examples/chef/esp32/sdkconfig_rpc.defaults b/examples/chef/esp32/sdkconfig_rpc.defaults
index bf2bcc8..1b9f9dd 100644
--- a/examples/chef/esp32/sdkconfig_rpc.defaults
+++ b/examples/chef/esp32/sdkconfig_rpc.defaults
@@ -61,5 +61,6 @@
 
 # IRAM optimizations
 CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
+CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
 
 CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y