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.

     

     

    Where can I find the media_recorder_obj.cpp file under Arduino development environment?

    Spresense
    2
    13
    1698
    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.
    • J
      jens6151 0 1 1 last edited by

      I had a look in the past, but I cannot find it inside Arduino SDK. I assume it gets pre-compiled when you build the Arduino SDK.

      If you only need the file for reference, I would suggest you install the Arduino plugin for VS code. I am using that. It works well. I use it in combination with the Arduino CLI. It "feels" also faster than the Arduino GUI.
      If you add the Spresense-SDK files folder to your project. VS Code can jump to the files with Go to Definition.

      However if you modify them I assume that you need to apply these steps
      https://developer.sony.com/develop/spresense/docs/arduino_set_up_en.html#_how_to_create_spresense_arduino_customized_package

      L 2 Replies Last reply Reply Quote
      • J
        jens6151 0 1 1 last edited by

        Update

        The output.map file in the Arduino output folder tells you where it is:
        precompiled inside
        <Arduino Library Folder>/Arduino15/packages/SPRESENSE_local/tools/spresense-sdk/2.5.2/spresense/release/nuttx/libs/libapps.a

        L 1 Reply Last reply Reply Quote
        • L
          Larry @jens6151 0 1 1 last edited by

          @jens6151-0-1-1 Thank you for your kind reply. Developing under VS code is indeed a good suggestion.

          1 Reply Last reply Reply Quote
          • L
            Larry @jens6151 0 1 1 last edited by

            @jens6151-0-1-1 Would you please provide a screenshot for this? I still do not understand how to check the output folder by using the libapps.a file. Thank you in advance for any help.

            1 Reply Last reply Reply Quote
            • J
              jens6151 0 1 1 last edited by

              You mean to find the location of the media_recorder_obj.cpp

              Above shows the content of the ArduinoOutput folder

              How to set or find the output folder
              It is specified in the arduino.json
              4bb4c0cd-a91e-4175-ac19-7270e8be9dc0-image.png

              Content of the output folder

              (base) Mini-2:ArduinoOutput jens$ ls -l
              total 21744
              -rw-r--r--    1 jens  staff      848 Jul 16 13:18 build.options.json
              -rw-r--r--    1 jens  staff  1723580 Jul 16 13:19 compile_commands.json
              drwxr-xr-x    2 jens  staff       64 Jul 16 13:19 core
              -rw-r--r--    1 jens  staff    59690 Jul 16 13:19 includes.cache
              drwxr-xr-x   31 jens  staff      992 Jul 16 13:19 libraries
              -rwxr-xr-x    1 jens  staff  4664112 Jul 16 13:19 main.ino.elf
              -rw-r--r--    1 jens  staff   476816 Jul 16 13:19 main.ino.spk
              -rw-r--r--    1 jens  staff  4195871 Jul 16 13:19 output.map
              drwxr-xr-x    3 jens  staff       96 Jul 16 13:19 preproc
              drwxr-xr-x  109 jens  staff     3488 Jul 16 13:19 sketch
              

              I searched the map file for "media_recorder_obj". There you can read libapps.a

              (base) Mini-2:ArduinoOutput jens$ grep  media_recorder_obj output.map | head -n1
              /Users/jens/Library/Arduino15/packages/SPRESENSE_local/tools/spresense-sdk/2.5.2/spresense/release/nuttx/libs/libapps.a(modules-media_recorder_obj.Users.jens.work.mcu_prj.prj.spresense.references.spresense-sdk.spresense.sdk.modules.audio.o)
              

              Opening libapps.a in a text editor does not make much sense because it is binary (except you see the strings of the symbols in this file)
              If you need to dig deeper, you can have a look at the tools

              • objdump
              • dwarfdump
              • readelf

              However I am no expert in reverse engineering. I would just dump as much as possible information and try to make sense by searching for keywords in the output.

              In our case the source code is inside the Spresense SDK.

              L 1 Reply Last reply Reply Quote
              • L
                Larry @jens6151 0 1 1 last edited by

                @jens6151-0-1-1 Hi Jens, Thank you for your kind reply. I misunderstood before. I thought that by opening the libapps.a file, there listed where the source file is located. Thanks again for your detailed explanation.

                1 Reply Last reply Reply Quote
                • L
                  Larry @jens6151 0 1 1 last edited by

                  @jens6151-0-1-1 Hi Jens, I just noticed a issue. After installing the Arduino plugin for VS Code, I do not know where can I flash applications for subcores. The same issue exists in Arduino RC2.0. Do you have any ideas on this? Thank you in advance for any help.

                  J 1 Reply Last reply Reply Quote
                  • J
                    jens6151 0 1 1 @Larry last edited by

                    @Larry

                    VS Code
                    Open the commands (Ctrl+Shift+P) and find Board Config. There is also Select Sketch to choose the .ino file for the sub core.
                    29aaf81a-6aaf-4e24-8542-b87e886157b6-image.png

                    There is also the bottom bar you can click for various actions and selections
                    3d1d059f-67a7-44d9-b0c3-c1b8474b9f6a-image.png

                    Arduino IDE
                    Sorry, I am using 1.8.16.

                    I noticed that switching cores and sketches in VSCode triggers a Verify automatically which can be tedious. It is possible to have both VSCode and Arduino IDE open. I have one for Main and one for Sub open. You just need to make sure not to block the other one by leaving the Serial Monitor open or try to flash in parallel. I read that you can open multiple instances of Arduino for each sub core (!! Arduino instances, not multiple sketches inside one Arduino instance)

                    L 1 Reply Last reply Reply Quote
                    • L
                      Larry @jens6151 0 1 1 last edited by

                      @jens6151-0-1-1 Hi Jens, Thank you for your kind reply. Yes, If I do not open multiple Arduino instances, changing the configuration for one core will affect applications on other cores. I also use Arduino 1.8.19. I just noticed that there is a recent release called Arduino 2.0RC which has some improvements that the current Arduino IDE. While it has some compatible issues when running multicore programs.

                      Eventually, would you please tell me how you debug under the Arduino environment right now? Currently, I just use printf statement for debugging. Do you use other tools or a debugger when debugging?

                      Thank you in advance for your reply.

                      Best,

                      Larry

                      J 1 Reply Last reply Reply Quote
                      • J
                        jens6151 0 1 1 @Larry last edited by

                        @Larry

                        I believe debugging under Arduino is not possible.
                        I soldered the connector for SWD onto the extension board, but I have no idea how to attach the debugger. VS Code activates the Spresense SDK extension.

                        Nevertheless there is hope. I did not investigate deelpy and a quick google search e.g. gives this page https://devblogs.microsoft.com/iotdev/debug-your-arduino-code-with-visual-studio-code/

                        In any case you need to do apply these instructions depending on your hardware

                        • https://developer.sony.com/develop/spresense/docs/hw_docs_lte_en.html#_how_to_use_the_jtag_debugger
                        • https://developer.sony.com/develop/spresense/docs/hw_docs_en.html#_HOW_TO_USE_JTAG_DEBUGGER

                        You also need special hardware. A debugger that supports Arm Cortex-M4.

                        J 1 Reply Last reply Reply Quote
                        • J
                          jens6151 0 1 1 @jens6151 0 1 1 last edited by

                          @Larry

                          OK it is more complex than I thought.
                          I only have a jlink device and no cmsis-dap device. So I am stuck. I will put this topic aside for now. Please let me know if you have more luck.

                          For your reference
                          https://developer.sony.com/develop/spresense/docs/sdk_set_up_ide_en.html#_ice_debugging

                          The configuration needs to be modified to work with Arduino. The instructions are only for the Spresense SDK.

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