Skip to content

Commit

Permalink
Pre-release of version 0.3.20
Browse files Browse the repository at this point in the history
  • Loading branch information
xthebat committed May 13, 2020
1 parent 7c4a0dc commit c18221b
Show file tree
Hide file tree
Showing 2,309 changed files with 694,967 additions and 8,726 deletions.
37 changes: 28 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,35 @@ temp

*.iml

.idea/dictionaries
.idea/compiler.xml
.idea/gradle.xml
.idea/encodings.xml
.idea/workspace.xml
.idea/libraries
.idea/modules

\.idea/jarRepositories\.xml
\.idea/compiler\.xml
\.idea/encodings\.xml
\.idea/workspace\.xml
\.idea/uiDesigner\.xml
\.idea/modules\.xml
\.idea/gradle\.xml

\.idea/dictionaries
\.idea/libraries
\.idea/modules

gradlew
gradlew\.bat

debuggers/kcdbg/cmake-build-win32/

debuggers/kcdbg/cmake-build-debug/

debuggers/kcdbg/\.idea/

plugins/kcdbg/cmake-build-osx/

plugins/kcdbg/cmake-build-win32/

plugins/kcdbg/cmake-build-osx-c166/

plugins/kcdbg/cmake-build-osx-v850es/

production/

\.idea/modules\.xml
gradle-wrapper.jar
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Changelog

- Core - changes relates to Kopycat emulator core/kernel
- x86/ARM/MIPS etc - changes relates to this architecture/processor core
- Gradle - changes in Gradle plugins or build scripts

## Version 0.3.20

Release date: 05.2020

Kopycat now is fully open-source project. In this release we try do our best to run different widespread systems on Kopycat emulator. Previous release can run STM32F0xx with FreeRTOS operating system. This time we add various examples of firmwares for unittesting emulator and to work with different peripheral modules. But the most exciting addition is Kopycat runs Linux on ARM MCU's ARM1176JZ. All these samples presented in sources and as prebuild modules. Also, a lot of bugs has been fixed in emulator core and in modules.

### Added

- Core: full open-source release
- Core: moved to OpenJDK and version updated to 11.0.x
- Core: register bank system `ARegisterBankNG` to simplify configuring processor core (currently only in ARM)
- Core: implemented fast wait-for-interrupt processing
- Auxiliary: NANDGen - NAND modules generator based on standard NAND parameters
- Auxiliary: NANDPart - NAND dump loader to partition dump by pages and add ECC in spares
- ARM: implemented partially MCU ARM1176JZ (enough to run Linux 2.6.x)
- ARM: implemented ARMv6 Coprocessor and MMU
- ARM: implemented generic timer for ARMv6
- ARM: implemented NS16550 UART-controller
- ARM: implemented PL190 (VIC) Vector Interrupt Controller
- ARM: implemented VirtARM - a virtual ARM-based device
- ARM: U-boot and Linux prebuild binaries based on buildroot in example
- ARM: implemented DMA-controller in STM32F042
- Others: different examples to show possible cases how to use Kopycat in projects
- Others: tested development of firmware to STM32 controller using CLion and Kopycat
- Gradle: Kopycat build plugin to simplify a configuration `build.gradle` of new emulator modules
- Gradle: dokkaMultilang build plugin to generate documentation on multiple languages, each language tags with "{EN}"/"{RU}" tokens

### Modified

- Core: embedded Python interpreter fixes, add autodetect of Python version and Jep library path
- ARM: fixed a lot of bugs in CPU's instructions
- ARM: fixed bugs in STM32F042

## Version 0.3.1

Release date: 26.12.2019

### Added

- Core: dynamic loading of Jep library (only for Python2)
- Core: logging calls when access to buses
- Core: slave port now can be connected to several buses

### Modified

- Core: fixed different bugs
- Core: CPU's cores tracer modified
- Core: method `exec` renamed to `cont` (incompatibility with Python interpreter)
- x86: fixed buses connection in x86Core
- x86: fixed critical bug of on cross page memory access (for Paging access mode)
- x86: bugs fixed in instructions (rol, ror)
- x86: implemented instructions: hlt, btr, partially support FPU
677 changes: 661 additions & 16 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.20
53 changes: 41 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,45 @@
apply plugin: 'java'
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

ext.productionDirectoryPath = "${rootProject.projectDir}/production"
ext.jarOutputDirectoryPath = "${productionDirectoryPath}/library"
plugins {
id 'org.jetbrains.kotlin.jvm' apply false
}

dependencies {
compile project(':cores:mips')
compile project(':cores:x86')
compile project(':cores:v850es')
compile project(':cores:msp430')
compile project(':cores:arm')
allprojects {
repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}

compile project(':mcu:cortexm0')
compile project(':mcu:stm32f0xx')
compile project(':mcu:msp430x44x')
ext.kotlinx_version = "1.0.1"
}

subprojects {
afterEvaluate {
tasks.each { task ->
if (task instanceof Test) {
task.jvmArgs += ["-Xms2G", "-Xmx5G", "-XX:MaxDirectMemorySize=2g"]

task.testLogging {
events "passed", "skipped", "failed" //, "standardOut", "standardError"

showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true

// showStandardStreams = false
}
}

if (task instanceof KotlinCompile) {
task.kotlinOptions {
jvmTarget = "11"
apiVersion = "1.3"
languageVersion = "1.3"
}
}

}
}
}
70 changes: 70 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version "1.3.61"
id 'org.gradle.java-gradle-plugin'
}

repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
implementation group: 'org.jetbrains.dokka', name: 'dokka-gradle-plugin', version: '0.10.0'
implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '+'
implementation("com.github.inforion:kotlin-extensions:+")
implementation("com.auth0:java-jwt:3.8.0")
implementation('com.github.oshi:oshi-core:3.13.0')
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.2")
implementation group: 'org.reflections', name: 'reflections', version: '0.9.11'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.8'


testImplementation("junit:junit:4.12")
testImplementation('org.junit.jupiter:junit-jupiter-api:5.1.0')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.1.0')
}

gradlePlugin {
plugins {
create("gradle-build-config-plugin") {
id = "ru.inforion.lab403.gradle.buildConfig"
implementationClass = "ru.inforion.lab403.gradle.buildConfig.BuildConfigPlugin"
}

create("gradle-version-config-plugin") {
id = "ru.inforion.lab403.gradle.versionConfig"
implementationClass = "ru.inforion.lab403.gradle.versionConfig.VersionConfigPlugin"
}

create("gradle-dokka-mutltilang-plugin") {
id = "ru.inforion.lab403.gradle.dokkaMultilang"
implementationClass = "ru.inforion.lab403.gradle.dokkaMultilang.DokkaMultilangPlugin"
}

create("gradle-kopycat-plugin") {
id = "ru.inforion.lab403.gradle.kopycat"
implementationClass = "ru.inforion.lab403.gradle.kopycat.KopycatPlugin"
}


}
}



compileKotlin {
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs += ['-Xuse-experimental=kotlin.contracts.ExperimentalContracts']
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs += ['-Xuse-experimental=kotlin.contracts.ExperimentalContracts']
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package ru.inforion.lab403.gradle.buildConfig

//import ru.inforion.lab403.common.logging
import ru.inforion.lab403.gradle.common.className
import ru.inforion.lab403.gradle.common.kotlinFileExtension
import ru.inforion.lab403.gradle.common.packageName
import ru.inforion.lab403.gradle.kodegen.Kodegen
import java.io.File

internal object BuildConfig {
// val log = logger(Level.INFO)

internal fun generateBuildConfig(configObject: String, properties: Map<String, Any>) = Kodegen {
pkg(configObject.packageName()) {
obj(configObject.className()) {
properties.forEach { (name, value) ->
// log.debug("Setup $name: ${value.javaClass.simpleName} = $value")
constval(name, value)
}
}
}
}

private fun createDirIfNotExists(dir: File) {
if (!dir.exists()) {
// log.lifecycle("Creating directory: '$dir'")
dir.mkdirs()
}
}

fun makeConfigSources(baseDir: File, configObject: String, properties: Map<String, Any>): Boolean {
val newSourceFile = File(baseDir, configObject.replace(".", "/") + kotlinFileExtension)

val output = generateBuildConfig(configObject, properties).toString()

if (newSourceFile.exists() && newSourceFile.readText() == output) {
// log.info("Nothing changed in '$configObject'")
return false
}

createDirIfNotExists(newSourceFile.parentFile)

// log.lifecycle("Writing config to '${newSourceFile.path}'\n$output")
newSourceFile.writeText(output)

return true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@file:Suppress("UnstableApiUsage")

package ru.inforion.lab403.gradle.buildConfig

import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import ru.inforion.lab403.gradle.common.kotlinPluginString


class BuildConfigPlugin : Plugin<Project> {
override fun apply(project: Project) {
if (!project.plugins.hasPlugin(kotlinPluginString))
throw GradleException("Plugin $kotlinPluginString must be applied!")

val task = project.tasks.create(BuildConfigTask.taskIdentifier, BuildConfigTask::class.java)
project.afterEvaluate { task.afterProjectEvaluate() }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package ru.inforion.lab403.gradle.buildConfig

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import ru.inforion.lab403.gradle.common.*
import java.io.File


open class BuildConfigTask : DefaultTask() {

companion object {
const val taskIdentifier = "buildConfig"
}

@Input var generatedPath = "generated"
@Input lateinit var configObject: String

private val baseDir get() = File(temporaryDir, generatedPath)

fun afterProjectEvaluate() {
buildConfig()
project.addKotlinSourceDir(baseDir)

project.compileKotlinTask.dependsOn(this)
project.cleanTaskOrNull?.delete(baseDir)
}

@TaskAction
fun buildConfig() {
if (BuildConfig.makeConfigSources(baseDir, configObject, extraProperties)) {
project.compileKotlinTask.rebuildRequired()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ru.inforion.lab403.gradle.common

import java.security.MessageDigest

fun ByteArray.sha1(): ByteArray {
val digester = MessageDigest.getInstance("SHA1")
return digester.digest(this)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ru.inforion.lab403.gradle.common.configurables

import groovy.lang.Closure

interface IConfigurable {

// val properties = HashMap<String, Any?>()

fun configure(closure: Closure<*>) {
closure.resolveStrategy = Closure.DELEGATE_FIRST
closure.delegate = this
closure.call()
}

// It's a Groovy implicit inheritance (Groovy will see it)
// fun methodMissing(name: String, value: Any?): Any? { // here we extract the closure from arguments, etc
// TODO("methodMissing called with name '$name' and args = $args")
// }

// It's a Groovy implicit inheritance (Groovy will see it)
// fun propertyMissing(name: String, value: Any?): Any? { // here we extract the closure from arguments, etc
// return properties.set(name, value)
// }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ru.inforion.lab403.gradle.common.configurables

interface IMethodConfigurable : IConfigurable {
// It's a Groovy implicit inheritance (Groovy will see it)
fun methodMissing(name: String, value: Any?): Any?
}
Loading

0 comments on commit c18221b

Please sign in to comment.