Sony's Developer World forum

    • Home
    • Forum guidelines

    Upcoming maintenance 

     

    Dear Customers and Partners.

    This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.

    This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.

    We apologize for any inconvenience.

     

     

    Writing an image SD card

    Spresense
    3
    17
    2812
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sskcyber01 last edited by

      Hello,
      I had tried to write an image into the SD card using the stb image library. Even though the image is written into the SD card the code after the stbi_write function is not executed and the nuttx Terminal shows these errors attached in the screenshot below. It would be great if someone can identify what is the error and how to rectify the same.

      nuttx Terminal Output:
      34baaf90-59a3-426e-8019-75dffee382f5-image.png

      Code:
      ab729218-c924-40bf-afe3-a5628b085395-image.png

      Thank you in advance 🙂 .

      Reference for stb_image library: https://solarianprogrammer.com/2019/06/10/c-programming-reading-writing-images-stb_image-libraries/

      K 1 Reply Last reply Reply Quote
      • K
        KamilTomaszewski DeveloperWorld @sskcyber01 last edited by

        Hi @sskcyber01

        Try to increase the stack size of your application

        • Run make menuconfig
        • Go to Application Configuration -> Spresense SDK -> Examples
        • Find your application and change the stack size from 2048 to 8192
        • Select <Save> and <Exit>
        • Build your app again

        Best Regards,
        Kamil Tomaszewski

        S 1 Reply Last reply Reply Quote
        • S
          sskcyber01 @KamilTomaszewski last edited by

          Thank you for the response @kamiltomaszewski. The application worked successfully by changing the STACKSIZE within the Makefile. Is there any maximum STACKSIZE for running an application ?

          Thanks in advance 🙂 .

          K 1 Reply Last reply Reply Quote
          • K
            KamilTomaszewski DeveloperWorld @sskcyber01 last edited by

            Hi @sskcyber01,

            There is no maximum for STACKSIZE, but you have to fit into Spresense RAM.

            Best Regards,
            Kamil Tomaszewski

            B 1 Reply Last reply Reply Quote
            • B
              Bhalaji Kharthik @KamilTomaszewski last edited by

              @KamilTomaszewski I tried changing the stack size value in makefile of my project yet I'm encountering same dump errors. Is the above way you mentioned the only way to change stack size?

              K 1 Reply Last reply Reply Quote
              • K
                KamilTomaszewski DeveloperWorld @Bhalaji Kharthik last edited by

                Hi @Bhalaji-Kharthik

                The method I described is recommended. If you use my method instead of modifying the Makefile do you get this error?

                Best Regards,
                Kamil Tomaszewski

                B 1 Reply Last reply Reply Quote
                • B
                  Bhalaji Kharthik @KamilTomaszewski last edited by

                  @KamilTomaszewski i tried executing make menuconfig but I get this error "make: *** No rule to make target 'menuconfig'. Stop.". Do you know any means to rectify it?

                  K 1 Reply Last reply Reply Quote
                  • K
                    KamilTomaszewski DeveloperWorld @Bhalaji Kharthik last edited by

                    Hi @Bhalaji-Kharthik When you try to run this command, are you under spresense/sdk?

                    B 1 Reply Last reply Reply Quote
                    • B
                      Bhalaji Kharthik @KamilTomaszewski last edited by

                      @KamilTomaszewski Now the command is running fine but I am not able to access projects outside spresense/sdk folder

                      K 1 Reply Last reply Reply Quote
                      • K
                        KamilTomaszewski DeveloperWorld @Bhalaji Kharthik last edited by

                        @Bhalaji-Kharthik That's good. Do you mean you don't see configuration of your application which is outside the spresense directory in menuconfig?

                        B 2 Replies Last reply Reply Quote
                        • B
                          Bhalaji Kharthik @KamilTomaszewski last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote
                          • B
                            Bhalaji Kharthik @KamilTomaszewski last edited by

                            @KamilTomaszewski yes, I am only able to see applications within spresense/sdk folder

                            K 1 Reply Last reply Reply Quote
                            • K
                              KamilTomaszewski DeveloperWorld @Bhalaji Kharthik last edited by

                              Hi @Bhalaji-Kharthik

                              How did you configure your application before?

                              Could you please send me a link to the documentation you used to create your project?

                              Best Regards,
                              Kamil Tomaszewski

                              B 1 Reply Last reply Reply Quote
                              • B
                                Bhalaji Kharthik @KamilTomaszewski last edited by Bhalaji Kharthik

                                @KamilTomaszewski I followed the steps to create a project from the below link.

                                https://developer.sony.com/develop/spresense/docs/sdk_set_up_ide_en.html#_creating_an_application_project

                                1 Reply Last reply Reply Quote
                                • K
                                  KamilTomaszewski DeveloperWorld last edited by

                                  @Bhalaji-Kharthik Ah, you are using the IDE. Then you need to change STACKSIZE in myproject/myapps/Makefile. Are you also trying to use std image library?

                                  B 1 Reply Last reply Reply Quote
                                  • B
                                    Bhalaji Kharthik @KamilTomaszewski last edited by

                                    @KamilTomaszewski Yes, i tried changing the stack size already in makefile but it doesn't seem to work. I am using stb image library. Are there any other reasons for getting stack dump errors?

                                    K 1 Reply Last reply Reply Quote
                                    • K
                                      KamilTomaszewski DeveloperWorld @Bhalaji Kharthik last edited by

                                      @Bhalaji-Kharthik You can get a stack dump after Hard Fault or Assert.

                                      I have just tried the stb library on the IDE and it works for me.

                                      I added this line to the Makefile: STACKSIZE = 8192

                                      My code looks like this:

                                      #include <nuttx/config.h>
                                      #include <stdio.h>
                                      #include <stdlib.h>
                                      
                                      #define STB_IMAGE_IMPLEMENTATION
                                      #include "stb_image/stb_image.h"
                                      #define STB_IMAGE_WRITE_IMPLEMENTATION
                                      #include "stb_image/stb_image_write.h"
                                      
                                      int main(int argc, char *argv[])
                                      {
                                        int width, height, channels;
                                        unsigned char *img = stbi_load("/mnt/sd0/test.jpg", &width, &height, &channels, 0);
                                        if(img == NULL) {
                                          printf("Error in loading the image\n");
                                          exit(1);
                                        }
                                        printf("Loaded image with a width of %dpx, a height of %dpx and %d channels\n", width, height, channels);
                                      
                                        stbi_write_jpg("/mnt/sd0/test2.jpg", width, height, channels, img, 100);
                                      
                                        stbi_image_free(img);
                                      
                                        return 0;
                                      }
                                      

                                      What is the size of the picture you are trying to read or write?

                                      1 Reply Last reply Reply Quote
                                      • First post
                                        Last post
                                      Developer World
                                      Copyright © 2021 Sony Group Corporation. All rights reserved.
                                      • Contact us
                                      • Legal