-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSCons_bootloader.py
More file actions
52 lines (50 loc) · 2.35 KB
/
SCons_bootloader.py
File metadata and controls
52 lines (50 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# .. "Copyright (c) 2008 Robert B. Reese, Bryan A. Jones, J. W. Bruce ("AUTHORS")"
# All rights reserved.
# (R. Reese, reese_AT_ece.msstate.edu, Mississippi State University)
# (B. A. Jones, bjones_AT_ece.msstate.edu, Mississippi State University)
# (J. W. Bruce, jwbruce_AT_ece.msstate.edu, Mississippi State University)
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose, without fee, and without written agreement is
# hereby granted, provided that the above copyright notice, the following
# two paragraphs and the authors appear in all copies of this software.
#
# IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS"
# HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
# ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
#
# Please maintain this header in its entirety when copying/modifying
# these files.
#
# ******************************************
# SCons_bootloader.py - Build the bootloader
# ******************************************
# This builds the bootloader for a given configuration. It should be invoked
# from the main SConstruct.py script.
import os
Import('env bin2hex linker_side_effect')
## Inform SCons about the dependencies in the template-based files
SConscript('templates/SConscript.py', 'env')
targetName = 'p${MCU}_${HW}_bootloader'
# Compile the bootloader to a .cof file.
p = env.Program(target=targetName, source=[
'bootloader/pic24_dspic33_bootloader.X/main.c',
'bootloader/pic24_dspic33_bootloader.X/mem.c',
'lib/src/pic24_configbits.c',
'lib/src/pic24_clockfreq.c',
'lib/src/pic24_uart.c',
'lib/src/pic24_serial.c',
'lib/src/pic24_util.c',
])
linker_side_effect(env, p)
# Convert it to a .hex
bin2hex(targetName, env, 'bootloader')
# Copy the .hex to the hex/ directory.
env.Command('../../hex/' + targetName + '.hex', targetName + '.hex', Copy("$TARGET", "$SOURCE"))