rap-tm4c1294
Advanced tools
Comparing version 0.5.3 to 0.6.0
{ | ||
"name": "rap-tm4c1294", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"description": "Rap extension for tm4c1294", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -23,2 +23,3 @@ 'use strict'; | ||
.option('--source', 'deploy source code directly without pre-compilation') | ||
.option('--file <path>', 'deploy the specified app file') | ||
.option('--use-32-bit', 'use 32 bit compiler') | ||
@@ -61,2 +62,36 @@ //.option('--force', 'force deployment even if a claim claims incompatable engine or board') | ||
if (program.file) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
let fileBuffer = fs.readFileSync(program.file); | ||
resolve(fileBuffer); | ||
} catch (error) { | ||
reject(error); | ||
} | ||
}) | ||
.then(fileBuffer => { | ||
// get program.serail | ||
let parameters = parametersJS.getParameters(rap, program); | ||
if (parameters === undefined) { | ||
program.serial = undefined; | ||
} else { | ||
program.serial = parameters.serial; | ||
} | ||
// create package and deploy it | ||
let appPath = tmp.tmpNameSync(); | ||
let appBuffer = alignAppForFlash(fileBuffer); | ||
fs.writeFileSync(appPath, appBuffer); | ||
if (origin < 0) { | ||
origin = 1024 * 1024 - appBuffer.length; | ||
} | ||
let cp = flash({ | ||
binary: appPath, | ||
serial: program.serial, | ||
address: origin | ||
}); | ||
return Promise.for(cp); | ||
}); | ||
} | ||
rap | ||
@@ -90,2 +125,3 @@ .getDeploymentManifest() | ||
let appBuffer = generateApp(manifest, toCompile, origin, alignment); | ||
appBuffer = alignAppForFlash(appBuffer); | ||
fs.writeFileSync(appPath, appBuffer); | ||
@@ -222,1 +258,13 @@ | ||
} | ||
function alignAppForFlash(appBuffer) { | ||
let flashAlignment = 4 * 1024; | ||
if (appBuffer.length % flashAlignment === 0) { | ||
return appBuffer; | ||
} | ||
let size = Math.ceil(appBuffer.length / flashAlignment) * flashAlignment; | ||
return Buffer.concat([ | ||
Buffer.alloc(size - appBuffer.length, 0), | ||
appBuffer | ||
]); | ||
} |
@@ -270,2 +270,8 @@ /* eslint-disable camelcase */ | ||
// NOTE: | ||
// JerryScript's bytecode must be 8 bytes aligned, | ||
// see docs/04.INTERNALS.md section "Compressed Pointers". | ||
// Since we put all data in "chars" region including bytecode, | ||
// therefore we need to align start address for each data with 8 bytes. | ||
// rofs_t | ||
@@ -272,0 +278,0 @@ relOffsetMap.rofs_t = relOffset; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36758
1043
9