Source code for android applications. Program source code

(Designer's Guide for HCS08 Microcontrollers)

In Example 12.1, we will look at the code that allows you to write and erase your own data in flash memory. Such actions may be necessary if the user of a device performs additional configuration of this device and wants the selected configuration to be saved after turning off the power.

Previously, we noted that HCS08 family MCUs do not allow performing erasing and programming flash memory operations, executing the control program for these modes also from flash memory. Be sure to first rewrite the program code responsible for the erasing and programming operations into RAM, and then run this code for execution. During the erasing and programming process, an increased voltage will be applied to the flash memory module. However, this will not cause the program to crash, since it will be executed from RAM at this point in time.

NXP has developed a set of assembly language utilities that make it easy to create your own code for programming flash memory under the control of the operating program of the device. These utilities are located in the file doonstack.asm. This file should be included in the project as shown in Fig. 12.3.

Rice. 12.3. Project window with included file doonstack.asm.

File contents doonstack.asm presented below. The original text of the program code used is given, so comments are not subject to translation.


;* This stationery is meant to serve as the framework for a *
;* user application. For a more comprehensive program that *
;* demonstrates the more advanced functionality of this *
;* processor, please see the demonstration applications *
;* located in the examples subdirectory of the *
;* Metrowerks Codewarrior for the HC08 Program directory *
;**************************************************************
; export symbols
XDEF DoOnStack
XDEF FlashErase
XDEF FlashProg
; we use export "Entry" as symbol. This allows us to
; reference "Entry" either in the linker .prm file
; or from C/C++ later on

; include derivative specific macros
Include "MC9S08GB60.inc"

The next two lines should be uncommented and assigned the desired values.

;mPageErase equ $40
;mByteProg equ $20
mFACCERR equ $10
mFPVIOL eq $20
mFCBEF $80
; variable/data section
MY_ZEROPAGE: SECTION SHORT
; Insert here your data definition. For demonstration, temp_byte is used.
; temp_byte ds.b 1
; code section
MyCode: SECTION
;**************************************************************
; this assembly routine is called the C/C++ application
DoOnStack:pshx
pshh ;save pointer to flash
psha ;save command on stack
ldhx #SpSubEnd ;point at last byte to move to stack;
SpMoveLoop: lda ,x ;read from flash
psha ;move onto stack
aix #-1 ;next byte to move
cphx #SpSub-1 ;past end?
bne SpMoveLoop ;loop till whole sub on stack
tsx ;point to sub on stack
tpa ;move CCR to A for testing
and #$08 ;check the I mask
bne I_set ;skip if I already set
sei ;block interrupts while FLASH busy
lda SpSubSize+6,sp ;preload data for command
cli ;ok to clear I mask now
bra I_cont ;continue to stack de-allocation
I_set: lda SpSubSize+6,sp ;preload data for command
jsr ,x ;execute the sub on the stack
I_cont: ais #SpSubSize+3 ;deallocate sub body + H:X + command
;H:X flash pointer OK from SpSub
lsla ;A=00 & Z=1 unless PVIOL or ACCERR
rts ;to flash where DoOnStack was called
;**************************************************************
SpSub: ldhx LOW(SpSubSize+4),sp ;get flash address from stack
sta 0,x ;write to flash; latch addr and data
lda SpSubSize+3,sp ;get flash command
sta FCMD ;write the flash command
lda #mFCBEF ;mask to initiate command
sta FSTAT ; register command
nop ;[p] want min 4~ from w cycle to r
ChkDone: lda FSTAT ; so FCCF is valid
lsla ;FCCF now in MSB
bpl ChkDone ;loop if FCCF = 0
SpSubEnd: rts ;back into DoOnStack in flash
SpSubSize: equ (*-SpSub)
;**************************************************************
FlashErase: psha ;adjust sp for DoOnStack entry

lda #mPageErase ;mask pattern for page erase command
bsr DoOnStack ;finish command from stack-based sub
rts
;**************************************************************
FlashProg: psha ;temporarily save entry data
lda #(mFPVIOL+mFACCERR) ;mask
sta FSTAT ;abort any command and clear errors
lda #mByteProg ;mask pattern for byte prog command
bsr DoOnStack ;execute prog code from stack RAM
ais #1 ;deallocate data location from stack
rts
;**************************************************************

Also in the text of the program code in C, the directive #include connect file doonstack.h, the text of which is shown below.


/* */
/* Project Name: doonstack.h */
/* Last modified: 04/11/2004 */
/* By: r60817 */
/* */
/* */
/**********************************************************************/
/* */
/* Description: MC9S08GB60_FLASH_DOONSTACK - demo */
/* */
/* */
/* Documentation: MC9S08GB60/D Rev. 2.2 */
/* HCS08RMv1/D Rev. 1(4.8FLASH Application Examples) */
/* */
/* This software is classified as Engineering Sample Software. */
/* */
/**********************************************************************/
/* */
/* Services performed by FREESCALE in this matter are performed AS IS */
/* and without any warranty. CUSTOMER retains the final decision */
/* relative to the total design and functionality of the end product. */
/* FREESCALE neither guarantees nor will be held liable by CUSTOMER */
/* for the success of this project. FREESCALE DISCLAIMS ALL */
/* WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY INCLUDING, BUT NOT */
/* LIMITED TO, IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A */
/* PARTICULAR PURPOSE ON ANY HARDWARE, SOFTWARE ORE ADVISE SUPPLIED */
/* TO THE PROJECT BY FREESCALE, AND OR NAY PRODUCT RESULTING FROM */
/* FREESCALE SERVICES . IN NO EVENT SHALL FREESCALE BE LIABLE FOR */
/* INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT. */
/* */
/* CUSTOMER agrees to hold FREESCALE harmless against any and all */
/* claims demands or actions by anyone on account of any damage, or */
/* injury, whether commercial, contractual, or tortuous, rising */
/* directly or indirectly as a result of the advise or assistance */
/* supplied CUSTOMER in connection with product, services or goods */
/* supplied under this Agreement. */
/* */
/**********************************************************************/
/*
- this file API between main.c and doonstack.asm
*/
#ifndef _doonstack
#define _doonstack
#ifdef __cplusplus
extern "C" ( /* our assembly functions have C calling convention */
#endif
void DoOnStack(void); /* prototype for DoOnStack routine */
void FlashErase(unsigned char *); /* prototype for FlashErase routine */
/* Page Erase command */
void FlashProg(unsigned char *, unsigned char); /* prototype for FlashProg routine */
/* Byte Program command */
#ifdef __cplusplus
}
#endif

#endif /* _doonstack */
/**********************************************************************/

In our example, a block of 512 bytes is reserved for writing non-volatile data. This block size was chosen because it is the minimum size of flash memory cells allowed for erasing in the MC9S08QG8 microcontroller. The selected block will be located at the beginning of the MCU's resident flash address space: 0xE000 to 0xE1FF. The program code will start at address 0xE200 and may occupy address space up to 0xFFFF.

In order to implement the intended placement of data and program codes, you need to change the linker settings in the file project.prm.

In the standard project there was an entry:


ROM = READ_ONLY 0xE000 TO 0xFFAD;

It should be replaced:

SEGMENTS /* Here all RAM/ROM areas of the device are listed */
ROM = READ_ONLY 0xE200 TO 0xFFAD;

In our example, the write protection mode of the program code area is also used, i.e. address space from 0xF200 to 0xFFFF. On Fig. 12. 4 shows the process of generating a code for the FPROT register, which provides protection for the address space 0xF200 ... 0xFFFF from accidental erasing / writing. The seven most significant bits of the last address 0xF1FF of the unprotected address space must be written to the FPROT register.

The address A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
0xE1FF 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1
FPROT FPS7 FPS6 FPS5 FPS4 FPS3 FPS2 FPS1 FPDIS
0xE0 1 1 1 0 0 0 0 0

Rice. 12.4. Formation of a security code entry for the FPROT register.

Example 12.1. Operations with non-volatile data in flash memory

// Demo Board DEMO9S08QG8
// erase/write/read resident flash
#include /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#include "hcs08.h" /* This is our declaration file! */
#include "doonstack.h"
#define BUSCLK 8000000
#define vFCDIV (BUSCLK/200000-1)
char fdata, operation;
unsigned int faddress;
// Assign write-protected address range: 0xE200 to 0xFFFF
const byte NVPROT_INIT@0x0000FFBD = 0xE0;
// Initialize MK
void mcu_init(void)
{
SOPT1=bBKGDPE; // Enable the BKGD debug line function
ICSSC=NV_FTRIM; // Write FTRIM trim value
ICSTRM = NV_ICSTRM; // Write TRIM trim value
ICSC2 = 0; // ICSOUT = DCOUT / 1
// BUSCLK = 8 MHz
FCDIV=vFCDIV; // Write the value of the divider code for the FCLK frequency
// (FCLK = 200 kHz)
}
#pragma inline
// Function for reading a byte from a memory cell with a given address
char flash_read(unsigned int address)
{
unsigned char *pointer;
pointer = (char*) address;
return(*pointer);
}
// The function of writing a byte to a memory cell with a given address
char flash_write(unsigned int address, unsigned char data)
{
unsigned char *pointer;
pointer = (char*) address;
FlashProg(pointer, data); // Call the flash programming function
if (FSTAT_FACCERR) data=1; elsedata=0;
if (FSTAT_FPVIOL) data|=2;
return(data);
}
// Function to erase the specified block in the flash memory area
unsigned char flash_sector_erase(unsigned int address)
{
unsigned char *pointer, res;
pointer = (char*) address;
FlashErase(pointer);
if (FSTAT_FACCERR) res=1; else res=0;
if (FSTAT_FPVIOL) res|=2;
return(res);
}
void main(void)
{
mcu_init();
fdata = 0;
faddress = 0xE000;
operation = 0;
while(1)
{
switch (operation)
{
case 1: // Erase block
fdata = flash_sector_erase(faddress);
operation = 0;
break;
case 2: // Write a byte
fdata = flash_write(faddress,fdata);
operation = 0;
break;
case 3: // Read a byte
fdata = flash_read(faddress);
operation = 0;
break;
}
}
}

Consider the methodology for testing the program code of Example 12.1. To do this, in the debugger window Data add three variables: faddress, fdata, operation. We will also set the window to update periodically, for example, after 200 ms.

Before running the program code, write to the variable faddress address to write, but to a variable fdata— byte of data to write. Next to the variable operation write down the code 0x02. After running the example program code, the data byte will be written to the selected flash memory location. Please note that the selected cell must be in an erased state, i.e. it should contain the code 0xFF.

To erase memory block 0xE00...0xE1FF, write to faddress any address from the specified range and set the variable operation c 1. Next, run the code again for execution.

Reading data from flash memory is also easy. To do this, put in a variable faddress address code, to a variable operation- code 0x03. The contents of the selected flash memory location will be displayed in the variable fdata after executing the code.

Please note that the functions flash_write() and flash_sector_erase() return a variable of type charge with an error code when performing the action: 0 - there was no error, 0x02 - there was an access error, 0x04 - there was an attempt to erase / write the protected address space. Both of these functions require about 35 bytes of stack memory to execute. If the real area of ​​the stack is smaller, then a fatal error will occur. It will be possible to restore the program's performance only by resetting the MK.

In order to view flash changes in the debugger, you need to make some changes to the debugger configuration. Following the default settings, the debugger reads an area of ​​the MCU's flash memory only once after starting a debug session. To change the configuration, select the option in the main menu of the debugger MultilinkCyclonPro > Debug Memory Map. The window shown in Fig. 12.5, a. Select in this window memory block 3 and press the button Modify/Details. In the new window shown in Fig. 12.5, b, select the marked option. It will allow the debugger to refresh the memory window periodically.

Rice. 12.5. Change the debugger configuration to periodically refresh the contents of the memory window.

Instruction

View the source code using its source. The source file contains the code written by the programmer when creating the software, after which it is compiled using special tools and turned into an installation file.

If you have lost the original file code, or it is not available to you for other reasons, use special decompiler programs. There are also disassembler programs. Please note that viewing the original code can often become impossible in cases where you do not know what programming language was used to develop it.

If you want to find free software code, search the internet for the appropriate query. Also try downloading this program and in its menu find the item “View source code". This is usually available for redistributable programs.

Be careful when using them, in particular, this applies to programs that are not downloaded from the developer's site, since the source may contain malicious code, which, when installed on your computer, also installs trojans, keyloggers, and so on.

Be careful when using decompiler programs, as many software developers use special programs that make it difficult to recreate the original code. If the program was written in assembler, special programs are also accepted.

There are quite a few reverse engineering tools, do not use them for fraudulent purposes or to make changes to closed source programs, since there are often certain penalties for these actions in accordance with the law.

Useful advice

Do not look at the code of closed programs and, moreover, do not make changes to it.

The program code can be different in terms of privacy - many developers do not put it in the public domain and the terms of the license agreement impose restrictions on users related to its use and viewing. There are also open source programs that can be viewed, edited, and so on.

You will need

  • - a program for opening source code.

Instruction

Please make sure that the source code of the software you wish to view is in the public domain. To do this, go to the official website of the software developer and view the type of license. If the source code of the program is closed, you cannot view it. This is inconvenient, however, with such a system, copies of the program containing Trojans and other malicious programs are quite rare. This is the main disadvantage of free software.

If you have free software, find the "Source code" in the program menu, if such an item is provided by the developer, which is extremely rare. To view it in other cases, use assembler or other third-party software.

Often, to open the source, you need to know what programming language the creators of the program used during development, which is often very difficult to determine. Here you can install on your computer a set of different programs for opening source codes written in different languages.

When using free software, if possible, review the source code before the installation process, especially if the program was downloaded from an unofficial source. This will help protect your computer from malware that is installed along with the main one.

Also, do not resort to various methods of making changes to the closed source code of the program, often in such cases there is a certain responsibility for violating the rules of the license agreement between the user and the developer. Moreover, do not post edited similar programs on the Internet.

Related videos

Useful advice

Check free software sources.

Ability to view original code various sites can be very useful for self-creation site. You can see the HTML code using special settings and additional browser extensions, as well as programs for viewing text files.

You will need

  • - browser program;
  • - notepad program.

Instruction

Find the menu item "Site source code" in the browser. For example, in the Mozilla Firefox program, it can be found in the "Web development" section, which is located in the "Tools" item of the main menu, and in the Internet Explorer browser, the call to view the html code is made from the "View" item of the main menu. Go to the site whose code you would like to examine. Once the page has loaded, select the Site Source Tool. The program will display a special window in which you will see the code. If the content of the page is displayed incorrectly, try changing the encoding.

The standard browser functions can be extended with a plugin. Often, on the site of the program developer, you can find an extension that allows you to view the code of the site. For example, the plugin for Mozilla Firefox is called Firebug, for the Opera browser it is called DragonFly. Download and install the plugin. You may need to restart your browser. Next, go to the desired site. Click on the button to call the plugin console - it can be located on one of the working panels of the program - after which an additional window will appear in which the source code of the opened page will be displayed.

Save the necessary pages of the site using the appropriate browser function. To do this, click on the main menu item "File" and select the inscription "Save as". Select a location on your computer where you will save a copy of the page. Then, from the drop-down menu labeled "File Type", select "Full Web Page" or "Web Page, HTML Only". Click on Save. Repeat the procedure with all the necessary pages of the Internet resource. Open the folder where the files were saved. Select one of the pages and launch it with the notepad program. You can use the Notepad utility installed in the Windows operating system, but it's better to download the more convenient Notepad ++ program. It has a function to separate different types of html tags by colors.

IMEI is an identification the code mobile phone. In case of theft or loss of a mobile phone, you can try to find it on this the code y, if you ask for help from the employees of the internal affairs bodies.

Instruction

Find out your IMEI phone by dialing *#06#. In a moment, this will be displayed on the screen of your mobile phone. the code. Thus, you can find out the IMEI of absolutely any cell model phone.

Take the box from your phone and examine it from all sides. The IMEI of the mobile phone is usually indicated not far from the bar the code and and has the form of a series of numbers or also a stroke the code a. If there is a possibility that this box may fall into the hands of dishonest people, hide it away so that they cannot take advantage of your carelessness.

Check out the documents on your mobile device. They also usually list the IMEI. Review the contract that you made out in the communication salon when buying phone. The IMEI is listed on the same line as "Model Name".

Turn off your phone, open its back cover, and carefully remove the battery. Inside the case you will see a sticker with information about the manufacturer phone, model, and identification the code. However, on some phone models, IMEI may not be indicated as a long series of numbers, but only as a barcode. the code a.

If you decide to buy a phone from your hands, ask the seller to provide you with all the documents for the mobile device and check the IMEI by dialing *#06# or opening the phone.

If your phone is stolen or lost, call your carrier first and block the number. After that, contact the police and provide the internal affairs officers with all the information you have about the time and place of the abduction or loss. But the most important thing that you must tell them is the identity the code your mobile device.

If for some reason you could not find out the IMEI phone, do not turn to Internet sites that offer a variety of programs and services that supposedly can help you not only learn the code mobile phone, but also unlock the old SIM card without PIN and PUK. Without access to the databases of telecom operators, this cannot be done. And telecom operators take care of security at the highest level.

The key with which you activated your software cannot be viewed in the usual way, such as the license code of the program, which is stored in the registry and can be accessed when it is launched or using other programs. Based on the license code, you can view the activation code on the official website of the application developer.

You will need

  • - a program for viewing the license code.

Instruction

Download Everest 2006 to your computer. Install it and run it. In the main window, select the software you are interested in, the license code of which you want to know. In the right part of the window, the information you need should appear. You can also save it to a file or print it. In any case, it is best to store such information not in electronic form or on removable media that you are not going to format.

Look at the license code of the program on the disk if you bought it as a product separate from the computer, on the box from it, and so on. Also, information about the software product code is contained in the registry of the operating system. To run it, open Run from the Start menu and type regedit in the box that appears.

Find the item in the directories on the left that is responsible for the software. Select the program you need, browse the folders for license information. Copy it.

Rewrite the license code obtained by one of the above methods. Go to the website of the software developer whose activation code you are interested in. Find the point of activation and registration of programs, if there is one on the site. Enter the license code for your software product and view the activation code available for it. This method is often convenient in cases where the activation of the software product is available on the site.

If this activation method is not available for your application, find out the code during reinstallation. Remove it completely through the control panel menu item "Add or Remove Programs" and remove the activation record, after making sure you have a licensed one. After installation, activate by viewing the key that matches your license code. Rewrite it.

Useful advice

Always save the information necessary to activate the program in the future, so as not to go through the procedure for obtaining the key again.

Let's see how to determine the original the code pages, because this parameter is very important when working on the Internet. If you need some news, tags or a picture, but you don’t know how to register it, you can always copy information from another site, having learned the original the code pages if he is not for the code edited by the developers of the site. Important initial the code in paginated files that are not programs, using the source the code and you can work with pages and edit them.

You will need

  • Instructions for viewing the source code of the page.

Instruction

To be visible, it is written with the original the code ohm. Fill it up with the code ohm you can, if you are the owner of the resource, or you can change it using notepad, editor, using special extensions for this. The user can also change the page by editing the file and adding their own . In - browsers view source the code and is carried out using various commands, we will consider them in more detail.

For Internet Explorer, select the "view" tab, then "source" the code pages» or the item can be selected by clicking the right mouse button. To encrypted by developers the code in this we go to the "service" menu, then "developer tools", press the arrow, select the desired element on and the code become . Then click on the icon and the code in text format and copy from its components to html.

The Mozilla Firefox browser provides the ability to view using a simple command "Ctrl + U" or in the "tools" menu select the substring "view source the code". You can view encrypted information in Mozilla Firefox by installing a special Web Developer, select " the code» string "generated the code» and below pages the original value appears the code a. Copy the file to the clipboard or save it with the page.htm extension.

When using Google Chrome, in the main "tools" menu, select the substring "view source the code", then using the right mouse button open the item" view the code a pages» or using the "Ctrl + U" keys.

For the Safari browser, in the menu we find "view html- the code”, also by pressing the right mouse button, open the substring “view source” or use the keyboard shortcut "Ctrl + Alt + U".

note

The ability to view encrypted information about the source code is carried out using two browsers.

Useful advice

If you are not a site developer, you can only change the page for your own use.

The program is its license code, on the basis of which an activation code is generated. This is done through communication via the Internet or by phone, and for some developers other methods of activation are also provided.

Every day there are more and more applications for Android. Millions of interesting games and useful programs can be found in the Play Market. All of them have a user-friendly interface and cope with the task. Without them, it is difficult to imagine the modern world of information technology. This article is aimed at people who not only appreciate the functionality and appearance of applications, but are also interested in their internal structure.

If you have ever wondered what is “under the hood” of your favorite application, and you know a little about programming, this article is for you. We will show you how to view the source code of an Android application right on your gadget. Go!

General information

Most programs for the Android OS, like most of the operating system itself, are written in the programming language. This means that when we look at the source code of Android programs, we are likely to see Java code using the Android SDK (which includes the Android platform tools). Again, to understand the source code of applications, you need to have a basic knowledge of Java and how Android works.

How to find the source code of android applications?

To get started, download the application whose source code you are interested in. Then go to the Play Market and download a utility called Show Java. It is she who will deal with the decompilation. Installed? Ok, now let's move on to the most interesting part - extracting the source code of the Android program. We start Show Java.

Select the desired application from the installed ones, or find it on the SD card. Now you need to choose a decompiler. I usually choose CRF. If you have problems, try JaDX.

Upon completion of the process, you will receive a list of packages with the source code for the Android application. Of course, this is not a 100% copy of the code that the developers of this application wrote. But the basic logic is preserved, it is not difficult to parse. What to do with sources? Anything. Look, disassemble, perhaps you will be interested in some of the “features” or features of the implementation of the program’s functionality.

Heading: September 3, 2014 at 04:07 pm

Do you really need the source code?

  • Microcontroller programming
  • Translation
Into many knowledges, many sorrows
If you ask any embedded software developer if they want to have access to the source code of the real-time operating system they use, the answer is almost certainly yes. The same is true with any purchased software. Is such an answer reasonable in all cases, and why is source code sometimes necessary and sometimes less useful than expected?

There are a number of key criteria that engineers use when choosing a real-time operating system (RTOS). Many of them - cost, functionality, licensing, support - are undoubtedly very important (especially cost - these are our realities). However, another criterion - the availability of source code - may not be as important, but is always rated as a strong factor.

The availability of the source code does not mean that it is supplied automatically and free of charge. This approach is only valid for open source products, and in other cases, manufacturers may charge for the source code or make it available upon request.

Iron development. There is also source code here, which is especially true for development using VHDL and Verlog. How are things here? Historically, when selecting an integrated circuit and designing its application, an engineer has relied on specifications that specify functionality, pinouts, power requirements, and so on. And at the same time, no one expected to see a complete diagram of the internal structure of an IC, although they often saw a block diagram (mainly as an illustrative material that facilitated understanding of the principles of operation), and sometimes even a circuit diagram (for analog ICs such as op-amps), although no denominations.
An engineer who designs ASICs or FPGA firmware today will most likely use some off-the-shelf IP blocks - a pre-packaged block that provides certain functionality. That being said, the choice will be based on specifications, and it's not at all obvious that the original HDL for IP will be included in the package. This black box approach is well known in the hardware world.

Safety. Any technology that is included in the product must be selected with future technical support in mind. For example, IC selection should avoid using unique products from a single manufacturer, which can mitigate supply disruption problems.
When using IP, whether it's hardware boxes or shipped software, delivery failures per se are unlikely to occur (except in the case of one-time licenses), but ongoing support must be present. Therefore, the question of whether your supplier will be in business throughout the life of your product is a better question before choosing a particular implementation.

If the source code for IP is available, it is possible to solve any (well, almost any) problems with the software, even if the vendor is no longer able to offer support. For this reason, many buyers of RTOS etc. like to have the source code on the shelf, even if they never look at it, just in case.

Software customization. The main difference between embedded systems and desktops is the variability of the former. Most PCs are similar to many others and the choice is only between the execution environment: Windows, Mac, or Linux. Embedded systems, in turn, are incredibly volatile—different processors, memory configurations, and peripherals. As a result, IP software must be flexible so that it can be deployed on different systems. Although many products, such as RTOS, are shipped in binary form - usually a library that is tuned to a particular architecture - the requirement to supply source code can incentivize vendors to eliminate the need to maintain and maintain many variations, since providing IP in source form solves many of these issues. The user can build code for a particular processor, adapt it to the device's memory card, and add the necessary device extensions. In some cases, the IP block can be configured using conditional compilation - typically, a header file is edited to determine the configuration.

Certification. For some types of applications, such as military/aviation and medical, firmware must be certified for safety and compliance with various standards. This process is complex and expensive and usually entails checking every line of code. Therefore, it is usually not possible to buy "pre-certified" software blocks, as the entire application is subject to review. Thus, a mission-critical application developer is likely to look for an IP that is available along with the source code so that a full check can be made.

What is Source Code?
The question may seem strange, but without an answer to it, the discussion of any aspects of its presence (or absence) turns into a somewhat strange exercise. The answer may seem obvious: the source code of a program is a set of files containing high-level language or assembly language instructions that can be compiled and assembled into functioning binary instructions. Immediately the question is - are the programs necessary for the conversion process and the execution environment for them part of the source code (in binary form)? However, there are at least 3 forms in which "source code" can be delivered (for example, let's talk about the C language) that meet this definition, in order of deteriorating quality:
1) Truly source code, with good layout, clear variable naming conventions, and well commented (provided that the IP developer has one, which is completely optional).
2) Lines of code that will compile successfully BUT without comments or particularly meaningful identifier names.
3) Lines of code after obfuscation, which makes the code unreadable by a person, but at the same time acceptable to the compiler. This is done by replacing the identifier names with meaningless ones and removing all comments and syntactically unnecessary spaces. There is a reverse process, but its results can hardly be called acceptable.
All of these forms are used by software providers for the following purposes:
1) is what most buyers expect and what many manufacturers actually provide. However, when making a purchase decision, if you require the source code, it is important to make sure that this is the option, if in doubt, just ask for samples.
2) is usually used when the seller wants to deliver the required minimum, which may be (only) good enough for certification.
3) is used to protect the contents of the IIP from prying eyes, which means that the software gets the benefit of configurability, but nothing more.

Source code flaws.
The biggest downside to having source code available is that it's a strong temptation. Every developer wants to make their software as good as possible (well, there is such a point of view). So, for example, if the RTOS API does not work exactly as it should be optimal for the application, the availability of the source code provides an opportunity to change it.
While it might seem like it's great to make an app optimal, there's also the issue of long-term support. What if there is a problem with RTOS functionality? The supplier will not support the modified product. What should I do if a new version of the RTOS is released? Including it in the redesign may require a significant amount of time for repeated modifications, especially if their author no longer works for you (well, either you made these modifications 3 years ago and of course, or, as they say, of course, you didn’t bother writing the appropriate documentation).

Having considered situations in which source code may be desirable, useful, or necessary, it should be concluded that it is not absolutely and always required. If you are purchasing an IP from a large, well known and stable vendor that can offer long term support, then having the source code is not relevant and may even be downgraded.

Purpose

The source code is either used to get the object code or executed by the interpreter. Changes are never made to the object code, only to the source code, followed by a re-transformation to the object code.

Another important purpose of source code is as a description of a program. According to the text of the program, you can restore the logic of its behavior. Comments are used to make the source code easier to understand. There are also tools that allow you to automatically obtain documentation of the source code - the so-called. documentation generators.

In addition, source code has many other uses. It can be used as a teaching tool; For novice programmers, it can be helpful to explore existing source code to learn programming techniques and methodology. It is also used as a communication tool between experienced programmers due to its concise and unambiguous nature. Code sharing among developers is often cited as a contributing factor to a better programmer experience.

Programmers often transfer source code (as modules, as is, or with adaptations) from one project to another, which is called code reuse.

Source code is an essential component in the process of porting software to other platforms. Without the source code for any piece of software, porting is either too difficult or not possible at all.

Organization

The source code of some part of the software (module, component) may consist of one or more . Program code is not necessarily written in only one programming language. For example, often programs written in the C language, for the purpose of optimization, contain inserts of code in assembly language. There are also situations where some components or parts of a program are written in different languages, and then assembled into a single executable unit using a technique known as library linking ( library linking).

Complicated software requires dozens or even hundreds of source code files to build. In such cases, to simplify the build, project files are usually used, containing a description of the dependencies between source files and describing the build process. These files may also contain options for the compiler and development environment. Different design environments may use different project files, and in some environments these files may be in a text format suitable for direct editing by a programmer using universal text editors, in other environments special formats are supported, and files are created and modified using special tools. programs. Project files are usually included in the concept of "source code". The vast majority of modern language environments make use of project files, regardless of the complexity of the other source code included in the project. Often, source code is also understood as resource files containing various data, for example, graphic images needed to build a program.

To facilitate the work with the source code, to collaborate on the code with a team of programmers, version control systems are used.

Quality

Unlike humans, there is no "well-written" or "poorly written" code for a computer. But how the code is written can have a big impact on the software maintenance process. The quality of the source code can be judged by the following parameters:

  • readability of the code (including the presence of comments to the code);
  • ease of support, testing, debugging and bug fixing, modification and porting;
  • economical use of resources - memory, processor, disk space;
  • lack of comments output by the compiler;
  • the absence of "garbage" - unused variables, unreachable code blocks, unnecessary obsolete comments, etc.;
  • adequate error handling;
  • portability - the ability to use a handler (compiler, interpreter, translator) of different versions, or even different operating systems;
  • the ability to internationalize the interface.

Non-executable source code

Copyleft licenses for free software require redistribution of source code. These licenses are often also used for non-software works such as documentation, images, data files for computer games.

In such cases, the source code is considered to be the form of the given work, which is preferable for its editing. In non-software licenses, it may also be referred to as the "transparent format" version. It could be, for example:

  • for a file compressed with data loss - lossless version;
  • for rendering a vector image or a three-dimensional model - respectively, the vector version and the model;
  • for text image - the same text in text format;
  • for music - a file in the internal format of the music editor;
  • and finally, the file itself, if it satisfies the specified conditions, or if a more convenient version simply did not exist.

see also


Wikimedia Foundation. 2010 .

See what "Source Code" is in other dictionaries:

    Source materials of the film negative, countertype, control copy of the film, original of magnetic phonograms of re-recording of music, noise, video phonogram master, CD, etc. Synonyms: the text is either directly executed by the interpreter, or ... ... Financial vocabulary

    Human-written text of a computer program in a programming language Glossary of business terms. Akademik.ru. 2001 ... Glossary of business terms

    source- - Telecommunication topics, basic concepts EN source code ... Technical Translator's Handbook

    source- 3.1.13 source code: A computer program expressed in a human-readable form (programming language) that is translated into a machine-readable form (object code) before it can be tested with ... ... Dictionary-reference book of terms of normative and technical documentation

    source- the language of the original text ... Explanatory Translation Dictionary

    Source code: The source code of a human-written text of a computer program. Source code for technothriller directed by Duncan Jones ... Wikipedia

    This term has other meanings, see source code. Source Code ... Wikipedia

    This article lacks links to sources of information. Information must be verifiable, otherwise it may be questioned and removed. You can ... Wikipedia

    Open Source Initiative (OSI) logo Open source software is open source software. The source code of the created programs is open, that is, available for viewing and modification. This is ... ... Wikipedia

    Source program (source code)- 48) source program (source code) a corresponding representation of one or more processes that can be converted by a programming system into a form executable by equipment (object code or object language) (categories 6, 7 and 9); … Official terminology