bojanpotocnik

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Built-in BSP with custom BSP_ROOT #12365
    bojanpotocnik
    Participant

    After a few hours of trying and Google-ing I stumbled upon my own topic again. However, now I am using nRF52832 and MSBuild build system (VisualGDB 5.3 Preview 8). I created the embedded project with specifying build flags manually, which is OK. But in this case I have a problem that there is no Makefiles, only MCU.xml,  $(ProjectName)-$(Configuration).vgdbsettings and $(ProjectDir)mcu.props files. If I add a new variable e.g. NRF5_SDK_ROOT in the User variables  section of the VisualGDB Project Properties and then use it in the paths under Embedded Project as $(NRF5_SDK_ROOT)\... it does not work, the variable is always empty.
    How does one use variables with MSBuild system?

    And about Embedded Project and MSBuild settings sections in the VisualGDB Project Properties – when are those set of settings synchronized (it seems like they’re not at all)? Which e.g. Include directories should I edit?

    Thank you.

    in reply to: Fatal error when creating new nRF52 project #9321
    bojanpotocnik
    Participant

    You are correct, I have disabled ReSharper extension during the installation and then instead of this error I was sent to your tutorial Installing Visual C++ Support – at that time I remembered I did not install Visual C++ support.

    After installing Visual C++ Support, I have enabled ReSharper plugin again and the project creation worked.

    Sorry for the inconvenience. It looks like ReSharper goes in the way of showing the pop-up message and opening the Installing Visual C++ Support webpage.

    in reply to: Fatal error when creating new nRF52 project #9312
    bojanpotocnik
    Participant

    I realized I haven’t had latest version of VisualGDB. With latest version, I get more verbose error output:

    VisualGDB version: 5.2.12.1241
    ------------------ System.ArgumentNullException ------------------
    System.ArgumentNullException: Value cannot be null.
    Parameter name: hierarchy
     at JetBrains.VsIntegration.ProjectModel.VsHierarchyEx.GetRootItem(IVsHierarchy hierarchy)
     at JetBrains.VsIntegration.IDE.VsSolutionEventsTracker.Microsoft.VisualStudio.Shell.Interop.IVsSolutionEvents.OnBeforeUnloadProject(IVsHierarchy pRealHierarchy, IVsHierarchy pStubHierarchy)
     at EnvDTE.SolutionClass.AddFromTemplate(String FileName, String Destination, String ProjectName, Boolean Exclusive)
     at jn.d_2(Solution c, String a, String e, String b, Boolean d)
     at kh.i(String b, String a)
     at VisualGDB.Wizard.Embedded.EmbeddedProjectWizardImpl.a_2(ti b, String c, String a)
     at d31`1.Execute(Object c, Int32 e, Object[]& d, Object[]& a, wizardResult& b)
    bojanpotocnik
    Participant

    So programming now works. Next thing I must to repair is sections – I see you use some custom sections in your example project? ESP bootloader reports errors and cannot start the example application properly.

    I forgot to flash boot_v1.4(b1).bin to 0x00000. Now it works! 🙂

    I also “fixed” debugging – right click on project -> Properties and changed values which are now bold:

    Content of programUpgradeBin.bat file located in project folder:

    C:\SysGCC\esp8266\python27\python.exe "C:\SysGCC\esp8266\esp8266-bsp\esptool.py" -p COM11 -b 921600 write_flash 0x01000 "%1"
    
    exit /b 0

    And now pressing F5 simply start up CMD window showing flashing progress. And the most beautiful thing (for me) – Visual Studio is not blocked while programming (CMD is running in background)! The only thing which happens in Visual Studio windows after pressing F5 is simple text:
    The program '[5476] programUpgradeBin.bat' has exited with code 0 (0x0).
    in Output window when programming completes.

     

    Sorry for bothering you. Maybe this will be helpful to someone in future or maybe even to you if you decide to implement such program-only feature. I switched to Visual Studio because there is by far no such programming IDE as Visual Studio 2015 + Visual Assist X + JetBrains ReSharper.

    • This reply was modified 8 years, 11 months ago by bojanpotocnik.
    bojanpotocnik
    Participant

    Bug fix – function write_file opens file in append mode, therefore a bit of additional code is needed in following block.

    Original:

    ** Next line is line 132 in original gen_appbin.py
        # irom0text_bin_name = 'eagle.app.v6.irom0text.bin'
        # text_bin_name = 'eagle.app.v6.text.bin'
        # data_bin_name = 'eagle.app.v6.data.bin'
        # rodata_bin_name = 'eagle.app.v6.rodata.bin'
        # flash_bin_name ='eagle.app.flash.bin'
        irom0text_bin_name = sys.argv[10]
        text_bin_name = sys.argv[7]
        data_bin_name = sys.argv[8]
        rodata_bin_name = sys.argv[9]
        flash_bin_name = sys.argv[11]
        app_sym_name = sys.argv[6]

    Fixed:

    ** Next line is line 132 in original gen_appbin.py
        # irom0text_bin_name = 'eagle.app.v6.irom0text.bin'
        # text_bin_name = 'eagle.app.v6.text.bin'
        # data_bin_name = 'eagle.app.v6.data.bin'
        # rodata_bin_name = 'eagle.app.v6.rodata.bin'
        # flash_bin_name ='eagle.app.flash.bin'
        irom0text_bin_name = sys.argv[10]
        text_bin_name = sys.argv[7]
        data_bin_name = sys.argv[8]
        rodata_bin_name = sys.argv[9]
        flash_bin_name = sys.argv[11]
        app_sym_name = sys.argv[6]
        try:
            os.remove(flash_bin_name)
        except:
            pass
    bojanpotocnik
    Participant

    I solved the problem when I discovered that VisualGDB doesn’t support (at least I didn’t find it) firmware building for OTA Upgrades (that means single .bin instead of .flash.bin + .irom0text.bin combination).

    Firstly, I edited the main project Makefile and added two sections. First,

    ###### Generate user.bin file for OTA Update enabled applications
    OBJDUMP := $(TOOLCHAIN_ROOT)/bin/xtensa-lx106-elf-objdump.exe
    NM := $(TOOLCHAIN_ROOT)/bin/xtensa-lx106-elf-nm.exe
    
    UPGRADEEDIR := $(BINARYDIR)/upgrade
    
    # boot_mode:
    #   0 = none
    #   1 = old (v1.2)
    #   2 = new (v1.4+)
    BOOT_MODE := 2
    
    # flash_mode:
    #   0 = QIO (Default)
    #   1 = QOUT
    #   2 = DIO
    #   3 = DOUT
    FLASH_MODE := 0
    
    # flash_clk_div:
    #   0 = 80 MHz / 2 = 40 MHz (Default)
    #   1 = 80 MHz / 3 = 26.1 MHz
    #   2 = 80 MHz / 4 = 20 MHz
    #  15 = 80 MHz / 1 = 80 MHz
    FLASH_CLK_DIV := 0
    
    # flash_size_map:
    #   0 = 512 KB (256 KB + 256 KB)
    #   1 = 256 KB
    #   2 = 1024 KB (512 KB + 512 KB)
    #   3 = 2048 KB (512 KB + 512 KB)
    #   4 = 4096 KB (512 KB + 512 KB)
    #   5 = 2048 KB (1024 KB + 1024 KB)
    #   6 = 4096 KB (1024 KB + 1024 KB)
    FLASH_SIZE_MAP := 5
    
    # Add to the end of output files
    PRIMARY_OUTPUTS += $(UPGRADEEDIR)/$(basename $(TARGETNAME)).bin
    #################################################################

    was added before all: $(PRIMARY_OUTPUTS) statement (rule). Second,

    ###### Generate user.bin file for OTA Update enabled applications
    $(UPGRADEEDIR):
        mkdir "$(UPGRADEEDIR)"
    
    # gen_appbin.py app.elf/app.out boot_mode flash_mode flash_clk_div flash_size_map
    # gen_appbinVGDB.py app.elf boot_mode flash_mode flash_clk_div flash_size_map app.sym app.text.bin app.data.bin app.rodata.bin app.irom0text.bin output
    $(UPGRADEEDIR)/$(basename $(TARGETNAME)).bin: $(BINARYDIR)/$(TARGETNAME) |$(UPGRADEEDIR)
        @$(NM) -g $< > $(basename $@).sym
        @$(OBJCOPY) --only-section .text -O binary $< $(basename $@).text.bin
        @$(OBJCOPY) --only-section .data -O binary $< $(basename $@).data.bin
        @$(OBJCOPY) --only-section .rodata -O binary $< $(basename $@).rodata.bin
        @$(OBJCOPY) --only-section .irom0.text -O binary $< $(basename $@).irom0text.bin
    
        @$(TOOLCHAIN_ROOT)/Python27/python.exe $(BSP_ROOT)/RTOS-SDK/tools/gen_appbinVGDB.py \
            $< $(BOOT_MODE) $(FLASH_MODE) $(FLASH_CLK_DIV) $(FLASH_SIZE_MAP) \
            $(basename $@).sym $(basename $@).text.bin $(basename $@).data.bin $(basename $@).rodata.bin $(basename $@).irom0text.bin $@
    
        @echo Generated upgrade file $@ with boot=$(BOOT_MODE), flash_mode=$(FLASH_MODE), flash_clk=$(FLASH_CLK_DIV), flash_size_map=$(FLASH_SIZE_MAP)
    #################################################################

    was added after clean: rule. Then I copied C:\SysGCC\esp8266\esp8266-bsp\RTOS-SDK\tools\gen_appbin.py file to C:\SysGCC\esp8266\esp8266-bsp\RTOS-SDK\tools\gen_appbinVGDB.py and made this changes:

    ** Next line is line 117 in original gen_appbin.py
        # if len(sys.argv) != 6:
        if len(sys.argv) != 12:
            # print 'Usage: gen_appbin.py eagle.app.out boot_mode flash_mode flash_clk_div flash_size_map'
            print 'Usage: gen_appbinVGDB.py app.elf boot_mode flash_mode flash_clk_div flash_size_map app.sym app.text.bin app.data.bin app.rodata.bin app.irom0text.bin output'
            sys.exit(0)
    ** Next line is line 132 in original gen_appbin.py
        # irom0text_bin_name = 'eagle.app.v6.irom0text.bin'
        # text_bin_name = 'eagle.app.v6.text.bin'
        # data_bin_name = 'eagle.app.v6.data.bin'
        # rodata_bin_name = 'eagle.app.v6.rodata.bin'
        # flash_bin_name ='eagle.app.flash.bin'
        irom0text_bin_name = sys.argv[10]
        text_bin_name = sys.argv[7]
        data_bin_name = sys.argv[8]
        rodata_bin_name = sys.argv[9]
        flash_bin_name = sys.argv[11]
        app_sym_name = sys.argv[6]
    ** Next line is line 132 in original gen_appbin.py
        # irom0text_bin_name = 'eagle.app.v6.irom0text.bin'
        # text_bin_name = 'eagle.app.v6.text.bin'
        # data_bin_name = 'eagle.app.v6.data.bin'
        # rodata_bin_name = 'eagle.app.v6.rodata.bin'
        # flash_bin_name ='eagle.app.flash.bin'
        irom0text_bin_name = sys.argv[10]
        text_bin_name = sys.argv[7]
        data_bin_name = sys.argv[8]
        rodata_bin_name = sys.argv[9]
        flash_bin_name = sys.argv[11]
        app_sym_name = sys.argv[6]
    ** Next line is line 149 in original gen_appbin.py
        # if os.getenv('COMPILE')=='xcc' :
        # cmd = 'xt-nm -g ' + elf_file + ' > eagle.app.sym'
        # else :
        # cmd = 'xtensa-lx106-elf-nm -g ' + elf_file + ' > eagle.app.sym'
        #
        # os.system(cmd)
    
        # fp = file('./eagle.app.sym')
        fp = file(app_sym_name)
    ** Next line is line 277 in original gen_appbin.py
        # cmd = 'rm eagle.app.sym'
        # os.system(cmd)
        os.remove(irom0text_bin_name)
        os.remove(text_bin_name)
        os.remove(data_bin_name)
        os.remove(rodata_bin_name)
        os.remove(app_sym_name)

    And after this modifications there is always also Test.bin file in Release\upgrade\ folder which I can program with a press of a button via epstool.py script:

    G:\ESP8266\Test\Test\Release\upgrade\>esptool.py -p COM11 -b 921600 write_flash 0x01000 Test.bin
    Connecting...
    Erasing flash...
    Wrote 267264 bytes at 0x00001000 in 16.8 seconds (127.3 kbit/s)...
    
    Leaving...

    So programming now works. Next thing I must to repair is sections – I see you use some custom sections in your example project? ESP bootloader reports errors and cannot start the example application properly. I think I will just use Espressif template project in examples RTOS-SDK\project_template\ folder.

    in reply to: Built-in BSP with custom BSP_ROOT #3263
    bojanpotocnik
    Participant

    Thank you for your answer.

    Approximately when will new version be released or is there any option for “Beta updates”? 😛

    I am using latest make, but it’s true that I use none of the tools provided with VisualGDB but Cygwin instead

    GNU Make 4.0
    Built for x86_64-pc-cygwin

    I will try using your make instead. Thank you.

Viewing 7 posts - 1 through 7 (of 7 total)