Skip to content

Conversation

@ohagendorf
Copy link
Contributor

@ohagendorf ohagendorf commented Jul 7, 2016

please see issue #391
an additional PR with some definitions belongs to this: PR project-generator/project_generator_definitions#95
extension of mbed not necessary - no additional template necessary

I tested with mbed and exporting of NUCLEO_F446RE, NUCLEO_F446ZE, NUCLEO_F401RE, NUCLEO_F411RE and NRF51_DK

  • NUCLEO_F446RE, NUCLEO_F446ZE, NUCLEO_F401RE have additional options in theire mcu configs
  • result: exporting with project.py, compiling and flashing out of the box - additional minimal uvoptx file is generated
  • NUCLEO_F411RE doesn't have the additional options
  • result: exporting with project.py - additional minimal uvoptx file isn't generated - behavior as before: flashing out of the box is not possible
  • NRF51_DK with J-Link
  • result: exporting with project.py - additional minimal uvoptx file isn't generated - behavior as before: flashing out of the box is possible
  • maybe for j-link the additional uvoptx file is not necessary

@ohagendorf
Copy link
Contributor Author

I changed back

def get_generated_project_files(self):

to original state because I can't see where/how it is used. And the tests failed because of my first changes there.

'Utilities': {
'Flash2': 'STLink\\ST-LINKIII-KEIL_SWO.dll',
},
'OptxFile' : {
Copy link
Member

@0xc0170 0xc0170 Jul 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to organize this dictionary. Utilities is for uvproj file, thus shall be under uvproj and OptxFile should be under uvopt? Mixing two different file options within one dictionary might lead to confusion later. I had to search for usage of OptxFile to see if it's applied to uvproj or optx :-)

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like this?

'st-link': {
    'uvproj' : {
        'TargetDlls': {
            'Driver': 'STLink\\ST-LINKIII-KEIL_SWO.dll',
        },
        'Utilities': {
            'Flash2': 'STLink\\ST-LINKIII-KEIL_SWO.dll',
        },
    }
    'uvopt' : {   (or maybe better 'uvoptx' because it is used only for Keil uvoptx files)
        'DebugOpt' : {
            'nTsel' : '11',
            'pMon': 'STLink\\ST-LINKIII-KEIL_SWO.dll',
        },
        'SetRegEntry' : {
            'Key' : 'ST-LINKIII-KEIL_SWO',
        },
    },
}
uvoptx_dic['ProjectOpt']['Target']['TargetOption']['DebugOpt']['nTsel'] = self.definitions.debuggers[debugger_name]['uvopt']['DebugOpt']['nTsel']
uvoptx_dic['ProjectOpt']['Target']['TargetOption']['DebugOpt']['pMon'] = self.definitions.debuggers[debugger_name]['uvopt']['DebugOpt']['pMon']
uvoptx_dic['ProjectOpt']['Target']['TargetOption']['TargetDriverDllRegistry']['SetRegEntry']['Key'] = self.definitions.debuggers[debugger_name]['uvopt']['SetRegEntry']['Key']

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. we use x prefix for uvision5, if this is common one, lets stay without x .

Yes, that was the idea, to provide dic per file, to know where goes what

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the possibility to check if it is a common one: I don't have Keil4.

For me the new principle looks logical. I was not very satisfied with my first proposal but didn't had a better idea.

@0xc0170
Copy link
Member

0xc0170 commented Jul 8, 2016

Reference for files for uvision : http://www.keil.com/support/man/docs/uv4/uv4_b_filetypes.htm , uvopt is mandatory and should be generated . 👍 for adding this.

NUCLEO_F411RE doesn't have the additional options

We need to provide those, correct?

NRF51_DK with J-Link

Looks like but we shall generate it and make sure it works with uvoptx. Thus my question is: what information from uvoptx is vital for debuggers and flashing (from a target definitions, and debuggers) ? Can you provide the information for this?

@0xc0170
Copy link
Member

0xc0170 commented Jul 8, 2016

I changed back
def get_generated_project_files(self):
to original state because I can't see where/how it is used. And the tests failed because of my first changes there.

The method should return path + files. It's used externally to request where the project files are and what files were generated . For instance for one tool it could be /path/projectfiles and file.1, file.2, file.3 . An application could do further processing like open file.3 (path + file) and start a debug session.

If this is not documented within Tool API, we should add it + wiki. Please create an issue if that's the case

@ohagendorf
Copy link
Contributor Author

I just checked an ARCH_MAX (STM32F407 with CMSIS-DAP). There the optx file is not needed.
But with another J-Link (EFM32ZG_STK3200) it is again necessary - in contrast to NRF51_DK with J-Link where it was not necessary.

So the best would be to generate it for all.

The NUCLEO_F411RE was only a test for me - see what happens when a mcu doesn't provide the new, additional debugger options.

@ohagendorf
Copy link
Contributor Author

Here is a minimal, manual minimised optx file:

<?xml version="1.0" encoding="utf-8"?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">

  <SchemaVersion>1.0</SchemaVersion>

  <Target>
    <TargetName>MBED_BLINKY</TargetName>
    <ToolsetNumber>0x4</ToolsetNumber>
    <ToolsetName>ARM-ADS</ToolsetName>
    <TargetOption>
      <DebugOpt>
        <uSim>0</uSim>
        <uTrg>1</uTrg>
        <nTsel>11</nTsel>
        <pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
      </DebugOpt>
      <TargetDriverDllRegistry>
        <SetRegEntry>
          <Number>0</Number>
          <Key>ST-LINKIII-KEIL_SWO</Key>
          <Name>-U0672FF535452775187153614 -O206 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F446ZETx$CMSIS\Flash\STM32F4xx_512.FLM)</Name>
        </SetRegEntry>
      </TargetDriverDllRegistry>
    </TargetOption>
  </Target>
</ProjectOpt>
  • TargetName has to be the same project name as in uvprojx file
  • ToolsetNumber and ToolsetName have constant values
  • uSim and uTrg corresponds to radio buttons use Simulator / use Debugger in Debugger pane
  • nTsel is the choosen Debugger combo box index in Debugger pane
  • pMon is the correspondig dll name to nTsel
  • Number is constant (0) - SetRegEntry can be contained several times, each a time another debugger is choosen an additional SetRegEntry is written but Number is everytime 0
  • Key is the dll name without path and '.dll' - this is the diffecence of several SetRegEntry
  • Name is the debugger configuration - I put this line into the mcu definition

The last option is debugger dependend. So we need debugger dependend options in the mcu yaml files. Maybe something like:
TargetDriverDllRegistry_SetRegEntry_Name_j-link: ...
TargetDriverDllRegistry_SetRegEntry_Name_st-link: ...
TargetDriverDllRegistry_SetRegEntry_Name_cmsis-dap: ...

@0xc0170
Copy link
Member

0xc0170 commented Jul 9, 2016

+1 for providing the minimal set.

The problem with this uvoptx is that to get this info:

      <TargetDriverDllRegistry>
        <SetRegEntry>
          <Number>0</Number>
          <Key>ST-LINKIII-KEIL_SWO</Key>
          <Name>-U -O206 -S0 -C0 -A0 -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD1FFFF000 -FC4000 -FN1 -FF0MK_P128_48MHZ.FLM -FS00 -FL020000 -FP0($$Device:MKL25Z128xxx4$Flash\MK_P128_48MHZ.FLM)</Name>
        </SetRegEntry>
        <SetRegEntry>
          <Number>0</Number>
          <Key>JL2CM3</Key>
          <Name>-U -O14 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD1FFFF000 -FC4000 -FN1 -FF0MK_P128_48MHZ.FLM -FS00 -FL020000 -FP0($$Device:MKL25Z128xxx4$Flash\MK_P128_48MHZ.FLM)</Name>
        </SetRegEntry>
        <SetRegEntry>
          <Number>0</Number>
          <Key>UL2CM3</Key>
          <Name>UL2CM3(-S0 -C0 -P0 )  -FN1 -FC4000 -FD1FFFF000 -FF0MK_P128_48MHZ -FL020000 -FS00 -FP0($$Device:MKL25Z128xxx4$Flash\MK_P128_48MHZ.FLM)</Name>
        </SetRegEntry>
      </TargetDriverDllRegistry>

You need to open debugger settings, switch debugger and open the tab with trace, than the info gets polluted (WTF 😭 ). Anyway, the info above I shared is from Trace tab, the rest -F is about flash algo (we care about generic MCU stuff at the moment). That seems to me it matches the uvproj settings FlashDriverDll. Have you tried to provide the same info? Would that work?

I see minimal uvoptx shall be generated ,but still trying to find out the minimal data we need. I would guess that only nTsel is needed , the rest we can get from what we have in the uvproj template.

}

# use first debugger from Keil5 debugger selection combo box as default debugger
debuggers_default = 'ulink2-me'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wan't the default one cmsis-dap? also set in the dicts for uvproj above (=default template)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just used the first entry as default. Of course we can use cmsis-dap.

Copy link
Member

@0xc0170 0xc0170 Jul 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets align template + this setting. if it was cmsis-dap, lets use that for now (that's default debugger also for progen def)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done.

@0xc0170
Copy link
Member

0xc0170 commented Jul 10, 2016

I'll run some tests tomorrow, the changeset looks fine

@0xc0170
Copy link
Member

0xc0170 commented Jul 11, 2016

LGTM, will integrate soon

@0xc0170 0xc0170 merged commit 220d275 into project-generator:master Jul 11, 2016
@ohagendorf ohagendorf deleted the uvoptx_file branch July 15, 2016 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants