Skip to content

Commit

Permalink
Merge branch 'release/v2.3.0' into merge-release-branch-into-main
Browse files Browse the repository at this point in the history
  • Loading branch information
bocchino committed Jan 30, 2025
2 parents 66192a6 + f319c72 commit 9bc7dc0
Show file tree
Hide file tree
Showing 20 changed files with 428 additions and 42 deletions.
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ There is also an FPP plugin available within Visual Studio Code.

See `compiler/README.adoc`.
To use or develop FPP in a standalone mode, you should install these tools.
To use FPP as part of F Prime development, you can install the F Prime tool set,
which includes FPP.
To use FPP as part of F Prime development, you can install the F Prime tool
set, which includes FPP.
See the F Prime installation instructions
https://fprime.jpl.nasa.gov/latest/getting-started/installing-fprime/[here].
https://fprime.jpl.nasa.gov/latest/docs/getting-started/installing-fprime/[here].

=== Spec and User's Guide

Expand Down
2 changes: 2 additions & 0 deletions compiler/.jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-XX:+CMSClassUnloadingEnabled
-Xss2M
4 changes: 2 additions & 2 deletions compiler/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lazy val settings = Seq(
"-deprecation",
"-unchecked",
"-Xfatal-warnings",
"-Xmax-inlines:200"
"-Xmax-inlines:100"
),
libraryDependencies ++= dependencies,
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oNCXELOPQRM"),
Expand Down Expand Up @@ -110,4 +110,4 @@ lazy val fpp_to_dict = (project in file("tools/fpp-to-dict"))
lazy val fpp_to_layout = (project in file("tools/fpp-to-layout"))
.settings(settings)
.dependsOn(lib)
.enablePlugins(AssemblyPlugin)
.enablePlugins(AssemblyPlugin)
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ object CheckComponentDefs
aNode: Ast.Annotated[AstNode[Ast.SpecRecord]]
) = {
val data = aNode._2.data
val record = Record.fromSpecRecord(a, aNode)
for {
idOpt <- a.getNonnegativeBigIntValueOpt(data.id)
record <- Record.fromSpecRecord(a, aNode)
component <- a.component.get.addRecord(idOpt, record)
}
yield a.copy(component = Some(component))
Expand Down
7 changes: 5 additions & 2 deletions compiler/lib/src/main/scala/analysis/Semantics/Record.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ object Record {

/** Creates a record from a record specifier */
def fromSpecRecord(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecRecord]]):
Record = {
Result.Result[Record] = {
val node = aNode._2
val data = node.data
val recordType = a.typeMap(data.recordType.id)
Record(aNode, recordType, data.isArray)
for {
_ <- a.checkDisplayableType(data.recordType.id, "type of record is not displayable")
}
yield Record(aNode, recordType, data.isArray)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -237,26 +237,25 @@ case class DictionaryJsonEncoder(
jsonWithOptionalValues(json, optionalValues)
}
case Symbol.Struct(preA, node, postA) => {
val Type.Struct(_, anonStruct, default, sizes, formats) = dictionaryState.a.typeMap(symbol.getNodeId)
val Type.AnonStruct(members) = anonStruct
val Type.Struct(_, _, default, sizes, _) = dictionaryState.a.typeMap(symbol.getNodeId)
val memberFormatMap = node.data.members.flatMap { case (_, memberNode, _) =>
memberNode.data.format.map(format => memberNode.data.name -> format.data)
}.toMap
val memberAnnotationMap = node.data.members.flatMap { case (preA, memberNode, postA) =>
val annotation = (preA ++ postA).mkString("\n")
if (annotation.isEmpty) None else Some(memberNode.data.name -> annotation)
}.toMap
val membersFormatted = for(((key, t), index) <- members.zipWithIndex) yield {
val membersFormatted = for(((_, m, _), index) <- node.data.members.zipWithIndex) yield {
val json = Json.obj(
"type" -> typeAsJson(t).asJson,
"type" -> typeAsJson(dictionaryState.a.typeMap(m.data.typeName.id)),
"index" -> index.asJson
)
val optionalValues = Map(
"size" -> sizes.get(key),
"format" -> memberFormatMap.get(key),
"annotation" -> memberAnnotationMap.get(key)
"size" -> sizes.get(m.data.name),
"format" -> memberFormatMap.get(m.data.name),
"annotation" -> memberAnnotationMap.get(m.data.name)
)
(key.toString -> jsonWithOptionalValues(json, optionalValues))
(m.data.name.toString -> jsonWithOptionalValues(json, optionalValues))
}
val json = Json.obj(
"kind" -> "struct".asJson,
Expand Down Expand Up @@ -550,4 +549,4 @@ case class DictionaryJsonEncoder(
}
}

}
}
21 changes: 21 additions & 0 deletions compiler/tools/fpp-check/test/record/not_displayable.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Fw {

port DpRequest
port DpResponse
port DpSend
port Time

}

passive component C {

product request port productRequestOut
sync product recv port productRecvIn
product send port productSendOut
time get port timeGetOut

type A
product container Container
product record R: A id 0x100

}
10 changes: 10 additions & 0 deletions compiler/tools/fpp-check/test/record/not_displayable.ref.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/record/not_displayable.fpp:19.21
product record R: A id 0x100
^
error: type of record is not displayable

[ local path prefix ]/compiler/tools/fpp-check/test/record/not_displayable.fpp:17.3
type A
^
Type is defined here
1 change: 1 addition & 0 deletions compiler/tools/fpp-check/test/record/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ missing_container
missing_ports
missing_product_recv_port
missing_product_send_port
not_displayable
ok
"
2 changes: 1 addition & 1 deletion compiler/tools/fpp-locate-uses/test/defs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ constant queue_size_def = 10
constant stack_size_def = 10
constant priority_def = 10
constant cpu_def = 0
type RecordType
constant record_id = 0
array RecordType = [3] U32
constant container_id = 0
constant container_priority = 0
constant product_recv_priority = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,112 @@
],
"default" : "Module1.E2.PASS"
},
{
"kind" : "struct",
"qualifiedName" : "Module1.ScalarStruct",
"members" : {
"u32" : {
"type" : {
"name" : "U32",
"kind" : "integer",
"size" : 32,
"signed" : false
},
"index" : 6
},
"f64" : {
"type" : {
"name" : "F64",
"kind" : "float",
"size" : 64
},
"index" : 9
},
"f32" : {
"type" : {
"name" : "F32",
"kind" : "float",
"size" : 32
},
"index" : 8
},
"i8" : {
"type" : {
"name" : "I8",
"kind" : "integer",
"size" : 8,
"signed" : true
},
"index" : 0
},
"i16" : {
"type" : {
"name" : "I16",
"kind" : "integer",
"size" : 16,
"signed" : true
},
"index" : 1
},
"u8" : {
"type" : {
"name" : "U8",
"kind" : "integer",
"size" : 8,
"signed" : false
},
"index" : 4
},
"u64" : {
"type" : {
"name" : "U64",
"kind" : "integer",
"size" : 64,
"signed" : false
},
"index" : 7
},
"i64" : {
"type" : {
"name" : "I64",
"kind" : "integer",
"size" : 64,
"signed" : true
},
"index" : 3
},
"i32" : {
"type" : {
"name" : "I32",
"kind" : "integer",
"size" : 32,
"signed" : true
},
"index" : 2
},
"u16" : {
"type" : {
"name" : "U16",
"kind" : "integer",
"size" : 16,
"signed" : false
},
"index" : 5
}
},
"default" : {
"u32" : 0,
"f64" : 0.0,
"f32" : 0.0,
"i8" : 0,
"i16" : 0,
"u8" : 0,
"u64" : 0,
"i64" : 0,
"i32" : 0,
"u16" : 0
}
},
{
"kind" : "struct",
"qualifiedName" : "Module1.S1",
Expand Down Expand Up @@ -253,14 +359,6 @@
],
"annotation" : "Parameter of type string"
},
{
"name" : "Module1.myFirstC1.PARAM1_PRM_SAVE",
"commandKind" : "save",
"opcode" : 773,
"formalParams" : [
],
"annotation" : "Parameter (struct)"
},
{
"name" : "Module1.myFirstC1.PARAM3_PRM_SET",
"commandKind" : "set",
Expand Down Expand Up @@ -405,6 +503,30 @@
],
"annotation" : "Command with 2 args (array of strings and U32)"
},
{
"name" : "Module1.myFirstC2.SendScalars",
"commandKind" : "sync",
"opcode" : 1026,
"formalParams" : [
{
"name" : "s",
"type" : {
"name" : "Module1.ScalarStruct",
"kind" : "qualifiedIdentifier"
},
"ref" : false
}
],
"annotation" : "Send scalars"
},
{
"name" : "Module1.myFirstC1.PARAM1_PRM_SAVE",
"commandKind" : "save",
"opcode" : 773,
"formalParams" : [
],
"annotation" : "Parameter (struct)"
},
{
"name" : "Module1.myFirstC1.PARAM5_PRM_SET",
"commandKind" : "set",
Expand Down
Loading

0 comments on commit 9bc7dc0

Please sign in to comment.