Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hardware configuration option support #2266

Merged
merged 4 commits into from Mar 15, 2021

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Mar 14, 2021

This PR aims to simplify use of hardware configurations via option settings. This allows common bits of configuration to be pulled in by name.

See #1712 (comment)

Comment on lines +1 to +10
{
"vdd": {
"description": "Modify PHY configuration to support `system_get_vdd33()` function",
"partitions": {
"phy_init": {
"filename": "$(FLASH_INIT_DATA_VCC)"
}
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@slaff Here's the glue for the 'vdd' option, just needs your code to implement FLASH_INIT_DATA_VCC

Allow options to be set using `HWCONFIG_OPTS` or in configuration
Show HWCONFIG setting with options when showing partition map
@slaff slaff added this to the 4.3.0 milestone Mar 15, 2021
@slaff slaff merged commit bae6f11 into SmingHub:develop Mar 15, 2021
@slaff
Copy link
Contributor

slaff commented Mar 15, 2021

@mikee47 Thank you and I like a lot the elegancy and flexibility of the hardware options!

@slaff
Copy link
Contributor

slaff commented Mar 15, 2021

@mikee47 I am having problems using the vdd option. I have tried on my machine and then katacoda's VM to enable vdd for Basic_Blink using this command

cd $SMING_HOME/../samples/Basic_Blink
make hwconfig HWCONFIG_OPTS=vdd

and in both places I get the following error:

Basic_Blink: Invoking 'hwconfig' for Esp8266 (debug) architecture
Traceback (most recent call last):
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/hwconfig.py", line 114, in <module>
    main()
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/hwconfig.py", line 96, in main
    config = Config.from_name(args.input)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 46, in from_name
    config.load(name, [] if options == '' else options.split(','))
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 56, in load
    self.parse_dict(data, options)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 78, in parse_dict
    self.parse_options(options)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 71, in parse_options
    self.parse_dict(temp)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 100, in parse_dict
    self.partitions.parse_dict(partitions, self.devices)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/partition.py", line 127, in parse_dict
    part = Entry(devices[0], name)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/storage.py", line 56, in __getitem__
    return super(List, self).__getitem__(item)
IndexError: list index out of range
Traceback (most recent call last):
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/hwconfig.py", line 114, in <module>
    main()
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/hwconfig.py", line 96, in main
    config = Config.from_name(args.input)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 46, in from_name
    config.load(name, [] if options == '' else options.split(','))
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 56, in load
    self.parse_dict(data, options)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 78, in parse_dict
    self.parse_options(options)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 71, in parse_options
    self.parse_dict(temp)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 100, in parse_dict
    self.partitions.parse_dict(partitions, self.devices)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/partition.py", line 127, in parse_dict
    part = Entry(devices[0], name)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/storage.py", line 56, in __getitem__
    return super(List, self).__getitem__(item)
IndexError: list index out of range

Traceback (most recent call last):
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/hwconfig.py", line 114, in <module>
    main()
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/hwconfig.py", line 96, in main
    config = Config.from_name(args.input)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 46, in from_name
    config.load(name, [] if options == '' else options.split(','))
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 56, in load
    self.parse_dict(data, options)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 78, in parse_dict
    self.parse_options(options)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 71, in parse_options
    self.parse_dict(temp)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/config.py", line 100, in parse_dict
    self.partitions.parse_dict(partitions, self.devices)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/partition.py", line 127, in parse_dict
    part = Entry(devices[0], name)
  File "/root/Sming/Sming/Components/Storage/Tools/hwconfig/storage.py", line 56, in __getitem__
    return super(List, self).__getitem__(item)
IndexError: list index out of range
/root/Sming/Sming/Components/Storage/component.mk:73: recipe for target 'hwconfig' failed
make: *** [hwconfig] Error 1

My wild guess is that merging of core opts with arch opts is not working.

Another related issue: The command below also does not work as expected:

make HWCONFIG_OPTS=4m,vdd hwconfig 

I get the following error:

Basic_Blink: Invoking 'hwconfig' for Esp8266 (debug) architecture
Error in partition entry 'phy_init': type/subtype missing
Error in partition entry 'phy_init': type/subtype missing

Error in partition entry 'phy_init': type/subtype missing
/tmp/Sming/Sming/Components/Storage/component.mk:73: recipe for target 'hwconfig' failed
make: *** [hwconfig] Error 2

@mikee47 mikee47 deleted the feature/hwconfig-options branch March 15, 2021 10:06
@mikee47
Copy link
Contributor Author

mikee47 commented Mar 15, 2021

@slaff Fixed by #2267

@slaff slaff mentioned this pull request Mar 17, 2021
5 tasks
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.

None yet

2 participants