Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
avrcwa
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leger
avrcwa
Commits
889541f7
Unverified
Commit
889541f7
authored
5 years ago
by
Jean-Benoist Leger
Browse files
Options
Downloads
Patches
Plain Diff
ID logic
parent
7eb329f0
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
Makefile
+6
-3
6 additions, 3 deletions
Makefile
define_id.py
+17
-0
17 additions, 0 deletions
define_id.py
id.h
+0
-11
0 additions, 11 deletions
id.h
with
25 additions
and
14 deletions
.gitignore
+
2
−
0
View file @
889541f7
...
...
@@ -5,3 +5,5 @@ __pycache__/
*.hex
*.elf
commitid.h
id.h
ID
This diff is collapsed.
Click to expand it.
Makefile
+
6
−
3
View file @
889541f7
...
...
@@ -16,19 +16,22 @@ COMPILE = avr-gcc -Wall -Os -mmcu=$(DEVICE)
.PHONY
:
clean all
.INTERMEDIATE
:
commitid.h main.o
.INTERMEDIATE
:
commitid.h
id.h message.o
main.o
# symbolic targets:
all
:
main.hex
clean
:
rm
-f
*
.o
*
.elf
*
.hex commitid.h
rm
-f
*
.o
*
.elf
*
.hex commitid.h
id.h
commitid.h
:
.git/refs/heads
cog
-r
*
.c
*
.h
./define_commit_id.py
>
$@
%.o
:
%.c common.h commitid.h
id.h
:
ID
./define_id.py
>
$@
%.o
:
%.c common.h commitid.h id.h
$(
COMPILE
)
-c
$<
-o
$@
.S.o
:
...
...
This diff is collapsed.
Click to expand it.
define_id.py
0 → 100755
+
17
−
0
View file @
889541f7
#!/usr/bin/python3
import
re
with
open
(
"
ID
"
)
as
f
:
content
=
f
.
read
().
strip
()
a
=
re
.
match
(
"
^0x([0-9a-fA-F]{2})$
"
,
content
)
if
not
a
:
raise
SyntaxError
(
hbid
,)
=
a
.
groups
()
bid
=
int
(
hbid
,
16
)
hbid
=
f
"
{
bid
:
02
x
}
"
print
(
f
"
#define BID 0x
{
hbid
}
"
)
print
(
f
"
#define BID_C0
'
{
hbid
[
0
]
}
'"
)
print
(
f
"
#define BID_C1
'
{
hbid
[
1
]
}
'"
)
This diff is collapsed.
Click to expand it.
id.h
deleted
100644 → 0
+
0
−
11
View file @
7eb329f0
/*[[[cog
bid = 0x01
hbid = f"{bid:02x}"
cog.out(f"#define BID 0x{hbid}\n")
cog.out(f"#define BID_C0 '{hbid[0]}'\n")
cog.out(f"#define BID_C1 '{hbid[1]}'\n")
]]]*/
#define BID 0x01
#define BID_C0 '0'
#define BID_C1 '1'
///[[[end]]]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment