Skip to content

Commit 1e400d6

Browse files
Ketil Skjervepatvilchez
Ketil Skjerve
authored andcommitted
Add scripts and project definition for MPLAB X IDE
Add a NetBeans Project that the Microchip MPLAB X IDE will recognize as a valid MPLAB X Project. The MPLAB X -defined type of this Project is "User Makefile". Add MPLAB X -specific Python scripts, which implement, notably, a "Kconfig" panel in the Project Properties. This GUI, as a frontend to Kconfiglib, offers features equivalent to the 'defconfig' and 'xconfig' Makefile rules. Note that MPLAB X uses Kconfiglib and not the Kconfig tools. Consequently, it is able to configure AT91Bootstrap without resorting to the command line. All Python scripts here are meant to be interpreted by Jython 2.7.
1 parent 5a69b47 commit 1e400d6

File tree

11 files changed

+1935
-0
lines changed

11 files changed

+1935
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config/at91bootstrap-config/
77
.auto.deps
88
.prepared
99
build
10+
debug
1011
result
1112
binaries
1213
*~
@@ -15,3 +16,6 @@ binaries
1516
tags
1617
*.swp
1718
*.pyc
19+
scripts/**/*$py.class
20+
default.config
21+
default.config.old

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,17 @@ distclean: clean config-clean
459459
$(Q)rm -f $(BINDIR)/pmecc.tmp
460460
$(Q)rm -f .configured
461461
$(Q)rm -f .prepared
462+
$(Q)rm -f $(subst $$,\$$,$(call rwildcard,scripts,*$$py.class))
463+
$(Q)rm -fr debug
464+
$(Q)rm -f default.config
465+
$(Q)rm -f default.config.old
466+
$(Q)rm -f nbproject/Makefile-default.mk
467+
$(Q)rm -f nbproject/Makefile-genesis.properties
468+
$(Q)rm -f nbproject/Makefile-impl.mk
469+
$(Q)rm -f nbproject/Makefile-local-default.mk
470+
$(Q)rm -f nbproject/Makefile-variables.mk
471+
$(Q)rm -f nbproject/Package-default.bash
472+
$(Q)rm -fr nbproject/private
462473

463474
mrproper: distclean
464475
@echo " CLEAN "binary files!

Makefile-mplab

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#
2+
# There exist several targets which are by default empty and which can be
3+
# used for execution of your targets. These targets are usually executed
4+
# before and after some main targets. They are:
5+
#
6+
# .build-pre: called before 'build' target
7+
# .build-post: called after 'build' target
8+
# .clean-pre: called before 'clean' target
9+
# .clean-post: called after 'clean' target
10+
# .clobber-pre: called before 'clobber' target
11+
# .clobber-post: called after 'clobber' target
12+
# .all-pre: called before 'all' target
13+
# .all-post: called after 'all' target
14+
# .help-pre: called before 'help' target
15+
# .help-post: called after 'help' target
16+
#
17+
# Targets beginning with '.' are not intended to be called on their own.
18+
#
19+
# Main targets can be executed directly, and they are:
20+
#
21+
# build build a specific configuration
22+
# clean remove built files from a configuration
23+
# clobber remove all built files
24+
# all build all configurations
25+
# help print help mesage
26+
#
27+
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
28+
# .help-impl are implemented in nbproject/makefile-impl.mk.
29+
#
30+
# Available make variables:
31+
#
32+
# CND_BASEDIR base directory for relative paths
33+
# CND_DISTDIR default top distribution directory (build artifacts)
34+
# CND_BUILDDIR default top build directory (object files, ...)
35+
# CONF name of current configuration
36+
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
37+
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
38+
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
39+
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
40+
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
41+
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
42+
#
43+
# NOCDDL
44+
45+
46+
# Environment
47+
MKDIR=mkdir
48+
CP=cp
49+
CCADMIN=CCadmin
50+
RANLIB=ranlib
51+
52+
53+
# build
54+
build: .build-post
55+
56+
.build-pre:
57+
# Add your pre 'build' code here...
58+
59+
.build-post: .build-impl
60+
# Add your post 'build' code here...
61+
62+
63+
# clean
64+
clean: .clean-post
65+
66+
.clean-pre:
67+
# Add your pre 'clean' code here...
68+
# WARNING: the IDE does not call this target since it takes a long time to
69+
# simply run make. Instead, the IDE removes the configuration directories
70+
# under build and dist directly without calling make.
71+
# This target is left here so people can do a clean when running a clean
72+
# outside the IDE.
73+
74+
.clean-post: .clean-impl
75+
# Add your post 'clean' code here...
76+
77+
78+
# clobber
79+
clobber: .clobber-post
80+
81+
.clobber-pre:
82+
# Add your pre 'clobber' code here...
83+
84+
.clobber-post: .clobber-impl
85+
# Add your post 'clobber' code here...
86+
87+
88+
# all
89+
all: .all-post
90+
91+
.all-pre:
92+
# Add your pre 'all' code here...
93+
94+
.all-post: .all-impl
95+
# Add your post 'all' code here...
96+
97+
98+
# help
99+
help: .help-post
100+
101+
.help-pre:
102+
# Add your pre 'help' code here...
103+
104+
.help-post: .help-impl
105+
# Add your post 'help' code here...
106+
107+
108+
109+
# include project implementation makefile
110+
include nbproject/Makefile-impl.mk
111+
112+
# include project make variables
113+
include nbproject/Makefile-variables.mk

autoload.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import os
2+
import sys
3+
import shutil
4+
from javax.swing import JPanel, JLabel , JTextField, BoxLayout
5+
from java.awt import BorderLayout
6+
from shutil import copyfile
7+
8+
log.setShowOutput(False)
9+
# log.info("Java version: " + System.getProperty("java.version"))
10+
# log.info("Jython version: " + sys.version)
11+
# log.info("Script path:" + os.path.dirname(os.path.abspath("__file__")))
12+
# log.info("Autoload SYS_PATH:" + '\n'.join(sys.path))
13+
for key in sys.modules.keys():
14+
if "mpconfig" in key:
15+
del sys.modules[key]
16+
from scripts.mpconfig.mpconfig import MPConfig
17+
from scripts.mpconfig import defconfig
18+
from scripts.mpconfig import genconfig
19+
from scripts import addpmecchead
20+
21+
def mplab_configure_Kconfig(confName):
22+
global app
23+
global project_dir
24+
25+
if os.getcwd() != project_dir:
26+
os.chdir(project_dir)
27+
28+
# log.info("mplab_configure_Kconfig: " + confName)
29+
dot_config_file = os.path.join(project_dir, confName + ".config")
30+
if not os.path.isfile(dot_config_file):
31+
# Create empty default.config file if it does not exist
32+
open(dot_config_file, 'a').close()
33+
34+
kconfig_file = os.path.join(os.getcwd(), "Kconfig")
35+
36+
# Set up GUI
37+
mpconfigPanel = JPanel()
38+
if os.path.isfile(kconfig_file):
39+
app = MPConfig(kconfig_file, dot_config_file, log)
40+
mpconfigPanel = app.getPane()
41+
42+
rootPanel = JPanel()
43+
rootPanel.setLayout(BorderLayout())
44+
rootPanel.add(mpconfigPanel, BorderLayout.CENTER)
45+
46+
return rootPanel
47+
48+
49+
def save_mplab_configure_Kconfig(confName):
50+
global app
51+
global project_dir
52+
53+
# log.info("save_mplab_configure_Kconfig: " + confName)
54+
try:
55+
dot_config_file = os.path.join(project_dir, confName + ".config")
56+
app.writeConfig(dot_config_file)
57+
58+
if confName == active_config:
59+
if os.path.isdir(os.path.join(project_dir, "config", "at91bootstrap-config")):
60+
shutil.rmtree(os.path.join(project_dir, "config", "at91bootstrap-config"))
61+
os.makedirs(os.path.join(project_dir, "config", "at91bootstrap-config"))
62+
defconfig.main([dot_config_file])
63+
genconfig.main(["--sync-deps", os.path.join("config", "at91bootstrap-config"), "--header-path", os.path.join("config", "at91bootstrap-config", "autoconf.h")])
64+
shutil.copyfile(dot_config_file, os.path.join(project_dir, ".config"))
65+
except:
66+
pass
67+
68+
69+
def onload(ide):
70+
# Load any stored settings
71+
global project_dir
72+
project_dir = ide.expandProjectMacros("${ProjectName}", "${ProjectDir}")
73+
74+
def on_project_build(e):
75+
global project_dir
76+
77+
dot_config_path = os.path.join(project_dir, ".config")
78+
binaries_path = os.path.join(project_dir, "binaries")
79+
addpmecchead.pmecchead(dot_config_path, binaries_path)
80+

nbproject/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Makefile-default.mk
2+
Makefile-genesis.properties
3+
Makefile-impl.mk
4+
Makefile-local-default.mk
5+
Makefile-variables.mk
6+
Package-default.bash
7+
private/

0 commit comments

Comments
 (0)