xtaskcreate-getting error - freertos

Hello I am working on EZ430-RF2560T target board attached to debugging interface (attached to USB of PC) for the Tux Racer game application (MSP430BT5190 target board ). I am working on the accelerometer application code. After the bluetooth is turned On it gives the message "unable to create task " for the function
xTaskCreate((pdTASK_CODE) user_task_routine,
(const signed portCHAR *)USER_TASK_NAME,
USER_TASK_STACK_SIZE, (unsigned portLONG *)NULL,
(unsigned portBASE_TYPE)USER_TASK_PRIORITY,
(xTaskHandle *) NULL);
Please let me know what could be done.........
Thankyou
Ashwin

Hard to say without more info or code. Looks like the task create line is straight from some dummy documentation or sample. Have you defined all the relevant parts such as USER_TASK_NAME, USER_TASK_STACK_SIZE, USER_TASK_PRIORITY, and especially the function user_task_routine?
Were there any compiler errors in this module?
The name "user task" sounds rather generic, maybe you might consider a descriptive name :)
Are other demo tasks running on the board? You might compare your task to them and see how they are started.
Could you simply be running out of memory? Try disabling some of the other tasks and starting only your task.
There is also a support community at freertos.org that tends to provide helpful responses.

Related

Cytoscape Error Loading KEGG Pathway Index Out of Bounds for length 1

I'm trying to use CytoKegg in Cytoscape to overlay data on a KEGG Pathway. After uploading the KGML file from KEGG, depending on which pathway, I'm either 1) Not getting the Cytoscape app to interact or 2) Receiving this error message: Error Loading KEGG Pathway Index Out of Bounds for length 1.
I have previously successfully used the macaque WNT & Melanogenesis pathways but am now having #2 occur with these pathways. I'd like to use the Hedgehog pathway and am having #1 happen. The only thing that has changed on my end since successfully doing this is I'm currently out of the US -- I don't think this would affect this app or KEGG but I'm not sure what else would have changed.
Any help is greatly appreciated so thanks in advance!!!
You could try contacting the App authors listed on this page to see if they can help: https://apps.cytoscape.org/apps/cykeggparser
and if that fails there is another Cytoscape App that can import KGML files: https://apps.cytoscape.org/apps/keggscape
chris

FFT in C++ AMP Throw CLIPBRD_E_CANT_OPEN error

I am trying to use C++ AMP in Visual C++ 2017 on Windows 10 (updated to the latest) and I find the archived FFT library from C++ AMP team on codeplex. I try to run the sample code, however the program throws ran out of memory error when creating DirectX FFT. I solve that problem by following the thread on Microsoft forum.
However, the problem doesn't stop. When the FFT library tries to create Unordered Access View, it throws error of CLIPBRD_E_CANT_OPEN. I did not try to operate on clipboard anyhow.
Thank you for reading this!
It seems I solve the problem. The original post mentioned that we need to create a new DirectX device and then create accelerator view upon it. Then I pass that view to ctor of fft as the second parameter.
fft(
concurrency::extent<_Dim> _Transform_extent,
const concurrency::accelerator_view& _Av = concurrency::accelerator().default_view,
float _Forward_scale = 0.0f,
float _Inverse_scale = 0.0f)
However, I still have crashes of the CLIPBRD_E_CANT_OPEN.
After reading the code, I realize that I need to create array on that DirectX views too. So I started to change:
array<std::complex<float>,dims> transformed_array(extend, directx_acc_view);
The idea comes from the different behaviors of create_uav(). The internal buffers and the precomputing caused no problem, but the samples' calls trigger the clipboard error. I guess the device matters here, so I do that change.
I hope my understanding is correct and anyway there is no such errors now.

Detect if Cycript/Substrate or gdb is attached to an iOS app's process?

I am building an iOS app that transmits sensitive data to my server, and I'm signing my API requests as an additional measure. I want to make reverse engineering as hard as possible, and having used Cycript to find signing keys of some real-world apps, I know it's not hard to find these keys by attaching to a process. I am absolutely aware that if someone is really skilled and tries hard enough, they eventually will exploit, but I'm trying to make it as hard as possible, while still being convenient for myself and users.
I can check for jailbroken status and take additional measures, or I can do SSL pinning, but both are still easy to bypass by attaching to the process and modifying the memory.
Is there any way to detect if something (whether it be Cycript, gdb, or any similar tool that can be used for cracking the process) is attached to the process, while not being rejected from App Store?
EDIT: This is not a duplicate of Detecting if iOS app is run in debugger. That question is more related to outputting and it checks an output stream to identify if there's an output stream attached to a logger, while my question is not related to that (and that check doesn't cover my condition).
gdb detection is doable via the linked stackoverflow question - it uses the kstat to determine if the process is being debugged. This will detect if a debugger is currently attached to the process.
There is also a piece of code - Using the Macro SEC_IS_BEING_DEBUGGED_RETURN_NIL in iOS app - which allows you to throw in a macro that performs the debugger attached check in a variety of locations in your code (it's C/Objective-C).
As for detecting Cycript, when it is run against a process, it injects a dylib into the process to deal with communications between the cycript command line and the process - the library has part of the name looking like cynject. That name doesn't look similar to any libraries that are present on a typical iOS app. This should be detectable with a little loop like (C):
BOOL hasCynject() {
int max = _dyld_image_count();
for (int i = 0; i < max; i++) {
const char *name = _dyld_get_image_name(i);
if (name != NULL) {
if (strstr(name, "cynject") == 0) return YES;
}
}
}
Again, giving it a better name than this would be advisable, as well as obfuscating the string that you're testing.
These are only approaches that can be taken - unfortunately these would only protect you in some ways at run-time, if someone chooses to point IDA or some other disassembler at it then you would not be protected.
The reason that the check for debugger is implemented as a macro is that you would be placing the code in a variety of places in the code, and as a result someone trying to fix it would have to patch the app in a variety of places.
Based on #petesh's answer, I found the below code achieved what I wanted on a jailbroken phone with Cycript. The existence of printf strings is gold to a reverse engineer, so this code is only suitable for demo / crack-me apps.
#include <stdio.h>
#include <string.h>
#include <mach-o/dyld.h>
int main ()
{
int max = _dyld_image_count();
for (int i = 0; i < max; i++) {
const char *name = _dyld_get_image_name(i);
const char needle[11] = "libcycript";
char *ret;
if ((ret = strstr(name, needle)) != NULL){
printf("%s\nThe substring is: %s\n", name, ret);
}
}
return 0;
}
As far as I know, Cycript process injection is made possible by debug symbols. So, if you strip out debug symbols for the App Store release (the default build setting for the Release configuration), that would help.
Another action you could take, which would have no impact on the usability of the App, would be to use an obfuscator. However, this would render any crash reports useless, since you wouldn't be able to make sense of the symbols, even if the crash report was symbolicated.

Adding a new language to Tesseract ios SDK

I am able to compile the English version which is already in sample for tesseract but not able to add other language like swe.traineddata.
I'm doing like this
G8RecognitionOperation *operation = [[G8RecognitionOperation alloc] initWithLanguage:#"eng+swe"];
When adding this its giving this error but working fine with English.
Cube ERROR (CubeRecoContext::Load): unable to read cube language model params from /private/var/mobile/Containers/Bundle/Application/D93B654A-1E46-4A34-9A83-95C6FC903085/*.app/tessdata/swe.cube.lm
Cube ERROR (CubeRecoContext::Create): unable to init CubeRecoContext object
init_cube_objects(true, &tessdata_manager):Error:Assert failed:in file tessedit.cpp, line 203
The fact it does not work has to do with the engine mode. If you use the CubeOnly or TesseractCubeCombined, you need 'cube' files. Engine mode TesseractOnly works fine.
you are missing some of files,I think so.Also check on Create Folder References.that helped me once.

Xcode 6 with Swift super slow typing and autocompletion

Is it just me or Xcode 6 (6.0.1) with Swift seems to be super slow when you type your code, especially with autocompletion?
A normal Objective-C class, even if inside a Swift project, works almost the same as before, so it's Swift that kills it.
Does anyone else experience the same inconvenience? Do you have any idea of how to improve performance?
I tried to play with some settings but no luck.
I've also of course tried restarting Xcode and the computer with no luck.
No other heavy
apps are open.
I use a Mid 2009 Macbook Pro (2.26 GHz Intel Core 2 Duo) with 8GB RAM and SSD HD, which is not the newest thing at all, but still not a complete junk.
It is a shame as I was excited to start using Swift and it is now really unbearable.
Thoughts / tips?
Quit Xcode and restart the Mac are not required but preferred.
Delete the content of the folder
~/Library/Developer/Xcode/DerivedData
Delete the content ~/Library/Caches/com.apple.dt.Xcode
This is a temporally solution, but works greatly.
Below the script using Script Editor app.
tell application "Terminal"
do script "rm -frd ~/Library/Developer/Xcode/DerivedData/*"
do script "rm -frd ~/Library/Caches/com.apple.dt.Xcode/*"
end tell
Alternatively, you can create an alias for your terminal like this:
alias xcodeclean="rm -frd ~/Library/Developer/Xcode/DerivedData/* && rm -frd ~/Library/Caches/com.apple.dt.Xcode/*"
You can add that to your ~/.bash_profile and then type xcodeclean on the command line every time you would like to clear those two folders.
I also experienced 100%+ CPU while typing some "simple" code. Some small tricks to make the swift-parser quicker by the way you structure your code.
Don't use the "+" concatinator in strings. For me this triggers the slowness very quickly.
Each new "+" brings the parser to a crawl, and it has to reparse the code everytime you add a new char somewhere in your function body.
Instead of:
var str = "This" + String(myArray.count) + " is " + String(someVar)
Use the template-syntax which seems much more efficient to parse in swift:
var str = "This \(myArray.count) is \(someVar)"
This way i basically notice no limit in strlen with inline vars "\(*)" .
If you have calculations, which use + / * - then split them into smaller parts.
Instead of:
var result = pi * 2 * radius
use:
var result = pi * 2
result *= radius
It might look less efficient, but the swift parser is much faster this way.
Some formulas won't compile, if they have to many operations, even if they are mathematically correct.
If you have some complex calculations then put it in a func. This way the parser can parse it once and does not have to reparse it everytime you change something in your function body.
Because if you have a calculation in your function body then somehow the swift parser checks it everytime if the types, syntax etc. are still correct. If a line changes above the calculation, then some vars inside your calculation / formula might have changed. If you put it in an external function then it will be validated once and swift is happy that it will be correct and does not reparse it constantly, which is causing the high CPU usage.
This way i got from 100% on each keypress to low CPU while typing.
For example this 3 lines put inline in your function body can bring the swiftparser to a crawl.
let fullPath = "\(NSHomeDirectory())/Library/Preferences/com.apple.spaces.plist"
let spacesData = NSDictionary(contentsOfFile: fullPath )! // as Dictionary<String, AnyObject>
let spaces : AnyObject = spacesData["SpacesDisplayConfiguration"]!["Management Data"]!!["Monitors"]!![0]["Spaces"]!!
println ( spaces )
but if i put it in a func and call it later , swiftparser is much quicker
// some crazy typecasting here to silence the parser
// Autodetect of Type from Plist is very rudimentary,
// so you have to teach swift your types
// i hope this will get improved in swift in future
// would be much easier if one had a xpath filter with
// spacesData.getxpath( "SpacesDisplayConfiguration/Management Data/Monitors/0/Spaces" ) as Array<*>
// and xcode could detect type from the plist automatically
// maybe somebody can show me a more efficient way to do it
// again to make it nice for the swift parser, many vars and small statements
func getSpacesDataFromPlist() -> Array<Dictionary<String, AnyObject>> {
let fullPath = "\(NSHomeDirectory())/Library/Preferences/com.apple.spaces.plist"
let spacesData = NSDictionary(contentsOfFile: fullPath )! as Dictionary<String, AnyObject>
let sdconfig = spacesData["SpacesDisplayConfiguration"] as Dictionary<String, AnyObject>
let mandata = sdconfig["Management Data"] as Dictionary<String, AnyObject>
let monitors = mandata["Monitors"] as Array<Dictionary<String, AnyObject>>
let monitor = monitors[0] as Dictionary<String, AnyObject>
let spaces = monitor["Spaces"] as Array<Dictionary<String, AnyObject>>
return spaces
}
func awakeFromNib() {
....
... typing here ...
let spaces = self.getSpacesDataFromPlist()
println( spaces)
}
Swift and XCode 6.1 is still very buggy, but if you follow these simple tricks, editing code becomes acceptable again. I prefer swift a lot, as it gets rid of .h files and uses much cleaner syntax. There is still many type-casting needed like "myVar as AnyObject" , but thats the smaller evil compared to complex objective-c project structure and syntax.
Also another experience, i tried the SpriteKit, which is fun to use, but its quite in-efficient if you don't need a constant repaint at 60fps. Using old CALayers is much better for the CPU if your "sprites" don't change that often. If you don't change the .contents of the layers then CPU is basically idle, but if you have a SpriteKit app running in background, then videoplayback in other apps might start to stutter due to the hardlimited 60fps update-loop.
Sometimes xcode shows odd errors while compiling, then it helps to go into menu "Product > Clean" and compile it again, seems to be a buggy implementation of the cache.
Another great way to improve parsing when xcode gets stuck with your code is mentioned in another stackoverflow post here. Basically you copy all contents from your .swift file into an external editor, and then function by function copy it back and see where your bottleneck is. This actually helped me to get xcode to a reasonable speed again, after my project went crazy with 100% CPU. while copying your code back, you can refactor it and try to keep your function-bodies short and functions/formulars/expressions simple (or split in several lines).
Autocomplete is broken since Xcode 4. Until Apple decides to fix this 2 years old bug, the only solution, unfortunately, is to turn code completion OFF on XCode's preferences (first option of the pic below).
You can continue to enjoy completion manually by typing CTRL space or ESC when you need it.
This is the only solution that works every time for 100% of the cases.
Another thing I have discovered recently is: if you use plugins on Xcode, don't. Remove them all. They make the problem worse.
Are you using Spotify?
I installed Yosemite GM with Xcode 6.1 GM on an iMac mid 2009 (2.66Ghz) having the same problem.I found that a process called "SpotifyWebHelper" is always marked red as not responding, so i disabled the option "start from web" in spotify and now Xcode seem to run significantly better.
I found out that usually happens when you:
have long expressions in a single statement (see this answer)
mix multiple custom operators in a single expression
The 2nd case seems to be fixed in one of the latest xcode releases. Example: I defined 2 custom operators <&&> and <||>, and used in an expression like a <&&> b <&&> c <||> d. Splitting to multiple lines solved the problem:
let r1 = a <&&> b
let r2 = r1 <&&> c
let r3 = r2 <||> d
I hope that your cases is covered by one of the 2 above... please post a comment either case
I had the same issues even in Xcode 6.3
super slow autocompletions
super slow indexing
enormous CPU usage by swift and SourceKitService
enormous Memory usage by SourceKitService
All this was happening even in relatively small project. I tried all the fixes I could find:
deleting ~/Library/Developer/Xcode/DerivedData/*
deleting ~/Library/Caches/com.apple.dt.Xcode/*
remove all "+" String combining from the code
removed all suspicious dictionary declarations
None of these actually helped in my project.
What actually solved my problem was:
placing each end every class in its own file
placing each and every extension in its own file (Class+ExtName.swift)
placing "out of class swift methods" in its own file
Now I have close to zero CPU usage, low memory usage, and decently fast completions.
Generally, moving the cache folder (DerivedData) to a SSD drive (specifically in my case - an outer storage connected to thunderbolt exit) has dramatically improved my Xcode performance.. Compilation time and general wondering around the app is about 10 time faster.. Also moved the whole git folder to the SSD, which dramatically improved git performance.
It was a pain until XCode 7.2.
Apple fixed it in XCode 7.3 and now it works like a charm. It's super fast and much more powerful as it seems to work a bit like the fuzzy search of files : you don't have to actually type the exact beginning of the method/property for it to appear in the list of propositions.
Collapsing all methods helps a little.
command-alt-shift-left arrow will do the trick...
To fold/unfold current methods or if structures use:
Fold: command-alt-left arrow
Unfold: command-alt-right arrow
SourceKitService is also kinda clumsy to deal with comments in the code and the embedded comments slow it down too.
so if you can afford to remove the massive blob of embedded comments like this:
/*
* comment
/*
* embedded comment
*/
*/
that can definitely help as well.
NOTE: in my case my Xcode 7.3.1 (7D1014) was literally blocked me typing any letter when the file had about 700 lines of comment with embedded comments. initially I removed that block from that .swift file and Xcode has become alive again. I tried added my comments back part by part by removing embedded comments, it was still slower than usual but it shown significantly better performance if there were no embedded comments.
I had the same issue where typing was lagging in a particular class and turns out that
/*
Long
multiline
comments
*/
was slowing down the typing.

Resources